Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* gcc 2.96 optimization bug on RedHat7.0/alpha
@ 2001-04-18  1:46 Uncle George
  2001-04-18  0:04 ` Christopher C. Chimelis
                   ` (2 more replies)
  0 siblings, 3 replies; 25+ messages in thread
From: Uncle George @ 2001-04-18  1:46 UTC (permalink / raw)
  To: gcc-bugs, axp-list

with -O2 i get the wrong answer

                [gat@LX gat]$ gcc -g -O2 a.c -o a
                [gat@LX gat]$ ./a
                FlooR: x = 22.16, i0=1, i1=536871996


with -O i get a passable answer

                [gat@LX gat]$ gcc -g -O a.c -o a
                [gat@LX gat]$ ./a
                FlooR: x = 22.16, i0=1077291253, i1=-1030792151


BTW what exactly is the page one uses to submit/fill in the bug report
for gcc et al ?

pgm is :

[gat@LX gat]$ cat a.c
double floor ( double );

main()
{
 double d = 22.16;
 floor( d );
}

double
floor( double x )
{
        int i0,i1;
        i0 = *((int*)&x+1);
        i1 = *(int*)&x;

printf("FlooR: x = %g, i0=%d, i1=%d\n",x, i0, i1);

        return x;
}




-----------------------------------------------------------
[gat@LX gat]$ gcc -v -save-temps  -g -O2 a.c -o a
Reading specs from /usr/lib/gcc-lib/alpha-redhat-linux/2.96/specs
gcc version 2.96 20000731 (Red Hat Linux 7.0)
 /usr/lib/gcc-lib/alpha-redhat-linux/2.96/cpp0 -lang-c -v -D__GNUC__=2
-D__GNUC_MINOR__=96 -D__GNUC_PATCHLEVEL__=0 -Dlinux -Dunix -D_LONGLONG
-D__alpha__ -D__ELF__ -D__linux__ -D__unix__ -D_LONGLONG -D__alpha__
-D__ELF__ -D__linux -D__unix -Asystem(linux) -D__OPTIMIZE__ -g
-D__LANGUAGE_C__ -D__LANGUAGE_C -DLANGUAGE_C -Acpu(alpha)
-Amachine(alpha) -D__alpha -D__alpha__ -D__alpha_ev4__ -Acpu(ev4) a.c
a.i
GNU CPP version 2.96 20000731 (Red Hat Linux 7.0) (cpplib)
 (Alpha GNU/Linux for ELF)
ignoring nonexistent directory "/usr/alpha-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/lib/gcc-lib/alpha-redhat-linux/2.96/include
 /usr/include
End of search list.
 /usr/lib/gcc-lib/alpha-redhat-linux/2.96/cc1 a.i -quiet -dumpbase a.c
-g -O2 -version -o a.s
GNU C version 2.96 20000731 (Red Hat Linux 7.0) (alpha-redhat-linux)
compiled by GNU C version 2.96 20000731 (Red Hat Linux 7.0).
 as -o a.o a.s
 /usr/lib/gcc-lib/alpha-redhat-linux/2.96/collect2 -m elf64alpha -O3
-dynamic-linker /lib/ld-linux.so.2 -o a
/usr/lib/gcc-lib/alpha-redhat-linux/2.96/../../../crt1.o
/usr/lib/gcc-lib/alpha-redhat-linux/2.96/../../../crti.o
/usr/lib/gcc-lib/alpha-redhat-linux/2.96/crtbegin.o
-L/usr/lib/gcc-lib/alpha-redhat-linux/2.96
-L/usr/lib/gcc-lib/alpha-redhat-linux/2.96/../../.. a.o -lgcc -lc -lgcc
/usr/lib/gcc-lib/alpha-redhat-linux/2.96/crtend.o
/usr/lib/gcc-lib/alpha-redhat-linux/2.96/../../../crtn.o
[gat@LX gat]$





^ permalink raw reply	[flat|nested] 25+ messages in thread
* RE: gcc 2.96 optimization bug on RedHat7.0/alpha
@ 2001-04-18 16:22 Hoover, Tony
  2001-04-18 16:55 ` David Woodhouse
  2001-04-18 17:07 ` alvin
  0 siblings, 2 replies; 25+ messages in thread
From: Hoover, Tony @ 2001-04-18 16:22 UTC (permalink / raw)
  To: 'axp-list@redhat.com'

Granted, however a compile time warning that your source will generate
"_undefined_  behavior" should not be out of the question.
---------------------------------------------------------------------------
Tony Hoover, Network Administrator 
KSU - Salina, College of Technology
mailto:hoover@sal.ksu.edu

"Don't Blend in..."
----------------------------------------------------------------------------


> ----------
> From: 	David Woodhouse[SMTP:dwmw2@infradead.org]
> Reply To: 	axp-list@redhat.com
> Sent: 	Wednesday, April 18, 2001 11:17 AM
> To: 	axp-list@redhat.com
> Subject: 	Re: gcc 2.96 optimization bug on RedHat7.0/alpha 
> 
> 
> gatgul@voicenet.com said:
> >  BTW your opinion about the code posted is broken, is also ur opinion.
> >  It is perfectly correct IMHO . I guess it just does not live up to
> > some one else's arbitrary standard.
> 
> The 'arbitrary standard' to which you refer is known as ISO C99. 
> 
> If you desire a compiler which lives up to other standards, that's fine -
> just don't report bugs against gcc. Do you see people reporting gcc to be 
> buggy because it doesn't compile FORTRAN code to produce the results you 
> expect?
> 
> 
> > I'm sorry that u believe this but i believe that the results from
> > -O0 == -O1 == -O2 == -O3 == -O4
> > should all be the same.  If any one of them failes to be equal, then
> > the compiler failed to produce the correct code to derive the correct
> > results.
> 
> That is an interesting opinion. The rest of the world, however, accepts
> the
> fact that according to the specifications of the C language, certain code
> has _undefined_ behaviour. If the compiler encounters such code, it's
> perfectly entitled to send insulting mail to your boss and sleep with your
> wife. It's certainly not required to do the same thing each time.
> 
> --
> dwmw2
> 
> 
> 
> 
> _______________________________________________
> Axp-list mailing list
> Axp-list@redhat.com
> https://listman.redhat.com/mailman/listinfo/axp-list
> 




^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2001-04-19  0:28 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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