Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: "P.TURLAIS" <pmt@gxt.com>
To: axp-list@redhat.com
Subject: Re: gcc 2.96 optimization bug on RedHat7.0/alpha
Date: Wed, 18 Apr 2001 18:09:30 -0500	[thread overview]
Message-ID: <3ADE1EAA.49264862@gxt.com> (raw)
In-Reply-To: 20010418153340.A28974@ellpspace.math.ualberta.ca

Michal Jaegermann wrote:
> 
> On Wed, Apr 18, 2001 at 06:18:13PM -0400, Uncle George wrote:
> > Its not my code segment, and from my experience a union might be better.
> > although from this discourse not safe either.
> >
> >  the code as stated should:
> >     1) take address of x
> >     2) make into int ptr
> >     3) add 1 to ptr  ( value of 4 bec its an int ptr )
> >     4) fetch integer from the address as calculated.
> 
> Well, yes, you translated the code from C to English.  But the
> question really was what you expect that it will happen after these
> operations and what kind of a _meaning_ you ascribe to that.

i0 should contain the bit sign, the exponent and a part of the mantissa.
i1 should contain the rest of the mantissa.
You can use these values for a conversion to another FP format (
VAX ( G or F ? ), IBM, CRAY ), to implement a function using tables
rather than math calls, to use the mantissa as an hash code ( because
the magnitude changes a lot, and a conversion to int doesn't give you 
a good hash function )  ....

 For me the semantic of the code is perfectly defined ( for a low-endian 
machine supporting ieee754, for a big-endian, you have to switch i0 & i1 ).

> > It should not matter if at x there is 8 bytes of a double, as that
> > distinction is superflous to the equation.
> 
> But if you think that some consistent results should come from this
> program then you assume that such "pointer puns" have a well defined
> semantics.  I do not recall that they ever had.

 Hum, I would say that a pointer is a pointer to an area. The fact that
you interpret the content of this area the wrong way is one thing,
the fact that this content changes because of a compilation flag is
another thing. May be the pointer to an argument is undefined ( I don't
think so, but I have no C ISO standards near me ... ) ?

Regards.
-- 
Pierre TURLAIS




  reply	other threads:[~2001-04-18 23:07 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-18  1:46 gcc 2.96 optimization bug on RedHat7.0/alpha Uncle George
2001-04-18  0:04 ` Christopher C. Chimelis
2001-04-18  3:41 ` Matt Wilson
2001-04-18  4:32 ` Brad Lucier
2001-04-18 15:13   ` Uncle George
2001-04-18 13:40     ` Pawel Salek
2001-04-18 15:53       ` Uncle George
2001-04-18 14:03     ` David Woodhouse
2001-04-18 17:10       ` Uncle George
2001-04-18 15:40         ` Pawel Salek
2001-04-18 16:17         ` David Woodhouse
2001-04-18 16:46         ` Andrew A. Gill
2001-04-18 17:04           ` T. Daniel Crawford
2001-04-18 18:15             ` Nelson Brito
2001-04-18 18:38         ` jeff.sturm
2001-04-18 14:55     ` Michal Jaegermann
2001-04-18 22:18       ` Uncle George
2001-04-18 20:50         ` Chris Eleveld (Sector 7 Group)
2001-04-18 21:33         ` Michal Jaegermann
2001-04-18 23:09           ` P.TURLAIS [this message]
2001-04-19  0:28           ` Uncle George
2001-04-18 22:03         ` jeff.sturm
  -- strict thread matches above, loose matches on Subject: below --
2001-04-18 16:22 Hoover, Tony
2001-04-18 16:55 ` David Woodhouse
2001-04-18 17:07 ` alvin
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox