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 D98C32FF52 for ; Wed, 18 Apr 2001 16:46:41 -0400 (EDT) Received: (from mail@localhost) by mail.redhat.com (8.11.0/8.8.7) id f3IKhJE08838 for axp-list@listman.redhat.com; Wed, 18 Apr 2001 16:43:19 -0400 Received: from taarna.sector7.com (taarna.sector7.com [216.166.14.10]) by mail.redhat.com (8.11.0/8.8.7) with ESMTP id f3IKhJC08834 for ; Wed, 18 Apr 2001 16:43:19 -0400 Received: (from chris@localhost) by taarna.sector7.com (8.11.2/8.9.3) id f3IKo4u01209 for axp-list@redhat.com; Wed, 18 Apr 2001 15:50:04 -0500 Date: Wed, 18 Apr 2001 15:50:04 -0500 From: "Chris Eleveld (Sector 7 Group)" To: axp-list@redhat.com Subject: Re: gcc 2.96 optimization bug on RedHat7.0/alpha Message-ID: <20010418155004.U30165@taarna.sector7.com> References: <200104180432.XAA03440@zakon.math.purdue.edu> <3ADDAF37.18D256A1@voicenet.com> <20010418085548.A28346@ellpspace.math.ualberta.ca> <3ADE12A4.777D7877@voicenet.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.4us In-Reply-To: <3ADE12A4.777D7877@voicenet.com>; from Uncle George on Wed, Apr 18, 2001 at 06:18:13PM -0400 X-Fortune: Don't get mad, get interest. 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: This brings up the thing that disturbs me most about the original code fragment. It assumes a double is in IEEE format and little endian. both dangerous assumptions. I do not believe the C standard specifies IEEE floating point semantics or types for math. The alpha in particular has and may be optimized for other floating point representations. I'm sure the alpha isn't the only system to do things differently. Just my 2 cents from the porting business, Chris 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. > > It should not matter if at x there is 8 bytes of a double, as that > distinction is superflous to the equation. > > anyway the segment was taken from a floor() function (akin to glibc: > ./sysdeps/ieee754/dbl-64/s_floor.c). > > static double huge = 1.0e300; > #endif > > #ifdef __STDC__ > double __floor(double x) > #else > double __floor(x) > double x; > #endif > { > int32_t i0,i1,j0; > u_int32_t i,j; > EXTRACT_WORDS(i0,i1,x); <== Majic happens behind this macro > which I suppose is tailored for each system > j0 = ((i0>>20)&0x7ff)-0x3ff; >: > > > Michal Jaegermann wrote: > > > On Wed, Apr 18, 2001 at 11:13:59AM -0400, Uncle George wrote: > > > Any compiler that does not produce the correct code has a bug - baring > > > any error messages. > > > > Indeed, but you should also add "from a correct source" for clarity. > > > > > I suppose one has to deceide if an error message should be produced > > > OR proper code should be produced. > > > > Can you explain what you intended to see from your example and why? > > I was looking at that code yesterday and scratching my head. I am > > still not absolutely sure what the _real_ meaning was supposed to be. > > > > If you want overlay different types you have 'union' construct for > > that. Playing loose with pointers was not guaranteed to work ever. > > > > _______________________________________________ > Axp-list mailing list > Axp-list@redhat.com > https://listman.redhat.com/mailman/listinfo/axp-list