From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.redhat.com (mail.redhat.com [199.183.24.239]) by listman.redhat.com (Postfix) with ESMTP id C261C2F0D1 for ; Wed, 18 Apr 2001 20:28:42 -0400 (EDT) Received: (from mail@localhost) by mail.redhat.com (8.11.0/8.8.7) id f3J0PKG30633 for axp-list@listman.redhat.com; Wed, 18 Apr 2001 20:25:20 -0400 Received: from smtp6ve.mailsrvcs.net (smtp6vepub.gte.net [206.46.170.27]) by mail.redhat.com (8.11.0/8.8.7) with ESMTP id f3J0PKC30629 for ; Wed, 18 Apr 2001 20:25:20 -0400 Received: from voicenet.com (adsl-141-155-119-64.nyc.adsl.bellatlantic.net [141.155.119.64]) by smtp6ve.mailsrvcs.net (8.9.1/8.9.1) with ESMTP id AAA12931820 for ; Thu, 19 Apr 2001 00:32:34 GMT Message-ID: <3ADE3143.E8F86D97@voicenet.com> Date: Wed, 18 Apr 2001 20:28:51 -0400 From: Uncle George X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.17-4 alpha) X-Accept-Language: en MIME-Version: 1.0 To: axp-list@redhat.com Subject: Re: gcc 2.96 optimization bug on RedHat7.0/alpha References: <200104180432.XAA03440@zakon.math.purdue.edu> <3ADDAF37.18D256A1@voicenet.com> <20010418085548.A28346@ellpspace.math.ualberta.ca> <3ADE12A4.777D7877@voicenet.com> <20010418153340.A28974@ellpspace.math.ualberta.ca> Content-Type: multipart/alternative; boundary="------------EDBD9D8B616BA72A3844C4A1" X-Loop: axp-list@redhat.com Sender: axp-list-admin@redhat.com Errors-To: axp-list-admin@redhat.com X-BeenThere: axp-list@redhat.com X-Mailman-Version: 2.0.1 Precedence: bulk Reply-To: axp-list@redhat.com List-Help: List-Post: List-Subscribe: , List-Id: Linux and Red Hat on Alpha processors List-Unsubscribe: , List-Archive: --------------EDBD9D8B616BA72A3844C4A1 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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. What happens after is also irrelevant, as there is no point on continuing with the routine if steps 1-4 of the equation dont happen. i ascribe no particular meaning to either I0, or I1. Just need to realize that the results are different between optimizations. > > > > 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. > I hope that pointer arith is well defined. and should yield the same results with -O0 -O1 -O2 and so on. > > > anyway the segment was taken from a floor() function (akin to glibc: > > ./sysdeps/ieee754/dbl-64/s_floor.c). > > This may even work for some particular platform and some particular > compiler, so it may be ok in internals of libraries, but it does > not mean that it can be copied elsewhere. > yup, ergo the majic statement to disassemble the double to 2 ints is a macro. But again, irrelevant to talk about the various other architectures. I have only posted a CPP'd snippet of the problem code to demonstrate the erroneous results, as per gnu c bug reporting info. Whats a pointer pun? /gat --------------EDBD9D8B616BA72A3844C4A1 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit 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.

What happens after is also irrelevant, as there is no point on continuing with the routine if steps 1-4 of the equation dont happen.  i ascribe no particular meaning to either I0, or I1. Just need to realize that the results are different between optimizations.
 

> 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.
 

I hope that pointer arith is well defined. and should yield the same results with -O0 -O1 -O2 and so on.
 
> anyway the segment was taken from a floor() function (akin to glibc:
> ./sysdeps/ieee754/dbl-64/s_floor.c).

This may even work for some particular platform and some particular
compiler, so it may be ok in internals of libraries, but it does
not mean that it can be copied elsewhere.
 

yup, ergo the majic statement to disassemble the double to 2 ints is a macro. But again, irrelevant to talk about the various other architectures. I have only posted a CPP'd snippet of the problem code to demonstrate the erroneous results, as per gnu c bug reporting info.
 

Whats a pointer pun?

/gat --------------EDBD9D8B616BA72A3844C4A1--