public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: egcs has some bad optimization bug
@ 1997-08-24  4:24 Jim Wilson
  0 siblings, 0 replies; 2+ messages in thread
From: Jim Wilson @ 1997-08-24  4:24 UTC (permalink / raw)
  To: egcs

	If I use egcs bootstrapped
	with -O -g, I can compile/run execute/cvt-1.c with -O3. But if
	I use egcs compiled with -O6 -fomit-frame-pointer I get 
	zsh: 15470 abort      ./a.out

This is fixed by the alias.c patch I posted yesterday.

Jim

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

* egcs has some bad optimization bug
@ 1997-08-24  3:43 H.J. Lu
  0 siblings, 0 replies; 2+ messages in thread
From: H.J. Lu @ 1997-08-24  3:43 UTC (permalink / raw)
  To: egcs

Hi,

I can verify that egcs has some bad optimization bug. In my case,
that is execute/cvt-1.c in c-tortore. If I use egcs bootstrapped
with -O -g, I can compile/run execute/cvt-1.c with -O3. But if
I use egcs compiled with -O6 -fomit-frame-pointer using egcs
bootstrapped with -O -g, I get

# gcc -O3 cvt-1.c
# a.out
zsh: 15470 abort      ./a.out

It seems that the bug is in optimization. I will see if I
can track it down.

Thanks.

H.J.
---
> 
> Below are the results from my machine at work -
> first for f2c+gcc 2.7.2.1 / g77 0.5.19.1 - then for the egcs snapshot.
> 
> When I did an 'ldd executable' on the running programs it seems that
> all have libf2c.a statically linked in, the only dynamic libraries
> were libc 5.3.12 and libm 5.0.6.
> 
> An important point about the -m[no-]ieee-fp flag:
> 
> when run with -O1 all seem ok - when run with -O2 f2c+gcc agrees
> between -mno-ieee-fp and -mieee-fp - however egcs produces complete
> garbage for -mno-ieee-fp with -O2 and higher. Similar results were
> observed with pgcc - in general I seem to get the fastest code when
> using gcc 2.7.2.1 with option -O2.
> 
> 
> Arno
> 
> RUNALL.gcc:
> ===========
> 
> Started Fri Aug 22 15:30:00 JST 1997
> attempt to open /usr/lib/crt1.o succeeded
> attempt to open /usr/lib/crti.o succeeded
> attempt to open /usr/lib/crtbegin.o succeeded
> attempt to open /usr/lib/gcc-lib/i486-linux/2.7.2.1/libf2c.a succeeded
> attempt to open /usr/lib/libm.so succeeded
> attempt to open /usr/lib/gcc-lib/i486-linux/2.7.2.1/libgcc.a succeeded
> attempt to open /usr/lib/libc.so succeeded
> attempt to open /usr/lib/gcc-lib/i486-linux/2.7.2.1/libgcc.a succeeded
> attempt to open /usr/lib/crtend.o succeeded
> attempt to open /usr/lib/crtn.o succeeded
> Finished Fri Aug 22 15:38:33 JST 1997
> 
> w0-1-gcc.log: COMPLETE BENCHMARK EXECUTION TIME :   28.070000 CP SECONDS.
> w0-1-gcc.log: COMPLETE BENCHMARK EXECUTION TIME :   26.790000 CP SECONDS.
> w0-1-gcc.log: COMPLETE BENCHMARK EXECUTION TIME :   26.770000 CP SECONDS.
> 
> w0-2-gcc.log: COMPLETE BENCHMARK EXECUTION TIME :   28.140000 CP SECONDS.
> w0-2-gcc.log: COMPLETE BENCHMARK EXECUTION TIME :   26.890000 CP SECONDS.
> w0-2-gcc.log: COMPLETE BENCHMARK EXECUTION TIME :   26.780000 CP SECONDS.
> 
> w0-x-gcc.log: COMPLETE BENCHMARK EXECUTION TIME :   29.590000 CP SECONDS.
> w0-z-gcc.log: COMPLETE BENCHMARK EXECUTION TIME :   27.000000 CP SECONDS.
> 
> w1-1-gcc.log: COMPLETE BENCHMARK EXECUTION TIME :   32.520000 CP SECONDS.
> w1-1-gcc.log: COMPLETE BENCHMARK EXECUTION TIME :   35.950000 CP SECONDS.
> w1-1-gcc.log: COMPLETE BENCHMARK EXECUTION TIME :   36.020000 CP SECONDS.
> 
> w1-2-gcc.log: COMPLETE BENCHMARK EXECUTION TIME :   32.450000 CP SECONDS.
> w1-2-gcc.log: COMPLETE BENCHMARK EXECUTION TIME :   36.030000 CP SECONDS.
> w1-2-gcc.log: COMPLETE BENCHMARK EXECUTION TIME :   36.070000 CP SECONDS.
> 
> RUNALL.egc:
> ===========
> 
> Started Fri Aug 22 16:12:20 JST 1997
> attempt to open /usr/lib/crt1.o succeeded
> attempt to open /usr/lib/crti.o succeeded
> attempt to open /usr/lib/gcc-lib/i686-pc-linux-gnulibc1/egcs-2.90.00/crtbegin.o succeeded
> attempt to open /usr/lib/gcc-lib/i686-pc-linux-gnulibc1/egcs-2.90.00/libf2c.a succeeded
> attempt to open /usr/lib/libm.so succeeded
> attempt to open /usr/lib/gcc-lib/i686-pc-linux-gnulibc1/egcs-2.90.00/libgcc.a succeeded
> attempt to open /usr/lib/libc.so succeeded
> attempt to open /usr/lib/gcc-lib/i686-pc-linux-gnulibc1/egcs-2.90.00/libgcc.a succeeded
> attempt to open /usr/lib/gcc-lib/i686-pc-linux-gnulibc1/egcs-2.90.00/crtend.o succeeded
> attempt to open /usr/lib/crtn.o succeeded
> Finished Fri Aug 22 16:22:41 JST 1997
> 
> w0-1-egc.log: COMPLETE BENCHMARK EXECUTION TIME :   37.330000 CP SECONDS.
> w0-1-egc.log: COMPLETE BENCHMARK EXECUTION TIME :   30.620000 CP SECONDS.
> w0-1-egc.log: COMPLETE BENCHMARK EXECUTION TIME :   30.540000 CP SECONDS.
> 
> w0-2-egc.log: COMPLETE BENCHMARK EXECUTION TIME :   36.990000 CP SECONDS.
> w0-2-egc.log: COMPLETE BENCHMARK EXECUTION TIME :   30.540000 CP SECONDS.
> w0-2-egc.log: COMPLETE BENCHMARK EXECUTION TIME :   30.540000 CP SECONDS.
> 
> w0-x-egc.log: COMPLETE BENCHMARK EXECUTION TIME :   30.110000 CP SECONDS.
> w0-z-egc.log: COMPLETE BENCHMARK EXECUTION TIME :   30.650000 CP SECONDS.
> 
> w1-1-egc.log: COMPLETE BENCHMARK EXECUTION TIME :   41.330000 CP SECONDS.
> w1-1-egc.log: COMPLETE BENCHMARK EXECUTION TIME :   37.010000 CP SECONDS.
> w1-1-egc.log: COMPLETE BENCHMARK EXECUTION TIME :   37.110000 CP SECONDS.
> 
> w1-2-egc.log: COMPLETE BENCHMARK EXECUTION TIME :   41.290000 CP SECONDS.
> w1-2-egc.log: COMPLETE BENCHMARK EXECUTION TIME :   36.960000 CP SECONDS.
> w1-2-egc.log: COMPLETE BENCHMARK EXECUTION TIME :   37.030000 CP SECONDS.
> 
> RUNALL script:
> ==============
> 
> #! /bin/tcsh -f
> 
> set Prefix=h
> if (`uname -n` == "array") set Prefix=w
> 
> set Compiler=egc
> if(`gcc --version` == "2.7.2.1") set Compiler=gcc
> echo Started `date` > RUNALL.$Compiler
> 
> rm -f mdbench.c
> f2c -A -w mdbench.f > & /dev/null
> gcc -O1 -Wl,-verbose -s -o junk mdbench.c second.c -lf2c -lm \
> |& grep lib |& grep succeeded >>& RUNALL.$Compiler
> rm mdbench.c junk
> 
> foreach n ( 0 1 )
> foreach m ( 1 2 )
> m$n > & $Prefix$n-$m-$Compiler.log
> end
> end
> 
> foreach m ( x z )
> m$m > & ${Prefix}0-$m-$Compiler.log
> end
> 
> echo Finished `date` >> RUNALL.$Compiler
> echo "" >> RUNALL.$Compiler
> grep COMPLE ${Prefix}*${Compiler}.log >> RUNALL.$Compiler
> 
> m0 script:
> ==========
> 
> #! /bin/tcsh -f
> 
> rm -f mdbench.c
> f2c -A -w mdbench.f > & /dev/null
> 
> gcc -v |& tail -1
> 
> foreach Opt ( 1 2 3 )
> 
> echo "f2c -A -w mdbench.f > & /dev/null"
> echo "gcc -O$Opt -m486 -malign-double -mno-ieee-fp -ffast-math -fomit-frame-pointer -s -o mdb$Opt mdbench.c second.c -lf2c -lm"
> 
> rm -f mdb$Opt
> 
> gcc -O$Opt -m486 -malign-double -mno-ieee-fp -ffast-math -fomit-frame-pointer -s -o mdb$Opt mdbench.c second.c -lf2c -lm
> 
> time mdb$Opt
> rm mdb$Opt
> 
> end
> 
> rm -f mdbench.c
> 
> m1 script:
> ==========
> 
> #! /bin/tcsh -f
> 
> g77 --version | head -1
> 
> foreach Opt ( 1 2 3 )
> 
> echo "g77 -O$Opt -m486 -malign-double -mno-ieee-fp -ffast-math -fomit-frame-pointer -s -o mdbf$Opt mdbench.f second.c"
> 
> rm -f mdbf$Opt
> 
> g77 -O$Opt -m486 -malign-double -mno-ieee-fp -ffast-math -fomit-frame-pointer -s -o mdbf$Opt mdbench.f second.c
> 
> time mdbf$Opt
> rm mdbf$Opt
> 
> end
> 
> mx script:
> ==========
> 
> #! /bin/tcsh -f
> 
> rm -f mdbench.c
> f2c -A -w mdbench.f > & /dev/null
> 
> gcc -v |& tail -1
> 
> set Opt=2
> set Mach=486
> 
> echo "f2c -A -w mdbench.f > & /dev/null"
> echo "gcc -O$Opt -m$Mach -malign-double -mieee-fp -s -o mdb$Opt mdbench.c second.c -lf2c -lm"
> 
> rm -f mdb$Opt
> 
> gcc -O$Opt -m$Mach -malign-double -mieee-fp -s -o mdb$Opt mdbench.c second.c -lf2c -lm
> 
> time mdb$Opt
> rm mdb$Opt
> 
> rm -f mdbench.c
> 
> mz script:
> ==========
> 
> #! /bin/tcsh -f
> 
> rm -f mdbench.c
> f2c -A -w mdbench.f > & /dev/null
> 
> gcc -v |& tail -1
> 
> set Opt=2
> set Mach=486
> 
> echo "f2c -A -w mdbench.f > & /dev/null"
> echo "gcc -O$Opt -m$Mach -malign-double -mno-ieee-fp -s -o mdb$Opt mdbench.c second.c -lf2c -lm"
> 
> rm -f mdb$Opt
> 
> gcc -O$Opt -m$Mach -malign-double -mno-ieee-fp -s -o mdb$Opt mdbench.c second.c -lf2c -lm
> 
> time mdb$Opt
> rm mdb$Opt
> 
> rm -f mdbench.c
> 

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

end of thread, other threads:[~1997-08-24  4:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-08-24  4:24 egcs has some bad optimization bug Jim Wilson
  -- strict thread matches above, loose matches on Subject: below --
1997-08-24  3:43 H.J. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).