public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* egcs has some bad optimization bug
@ 1997-08-24  3:43 H.J. Lu
  1997-08-24  3:43 ` Building of generated parser files Tom Tromey
  1997-08-24  3:43 ` explicitly initializing automatics with specific (garbage) values Andi Kleen
  0 siblings, 2 replies; 4+ 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] 4+ messages in thread

* Re: Building of generated parser files
  1997-08-24  3:43 egcs has some bad optimization bug H.J. Lu
@ 1997-08-24  3:43 ` Tom Tromey
  1997-08-24  3:43 ` explicitly initializing automatics with specific (garbage) values Andi Kleen
  1 sibling, 0 replies; 4+ messages in thread
From: Tom Tromey @ 1997-08-24  3:43 UTC (permalink / raw)
  To: egcs

Richard> Why not just detect which programs are available and enable
Richard> all found?  I presume it is not the fractional extra build
Richard> time that is the reason for wanting to conditionalize this.

Richard> And possibly use --enable-maintaner-mode to unconditionally
Richard> enable the sections so that the maintainers are made aware
Richard> that there is a problem.

Automake actually has two different facilities for handling this
problem.

The first, --enable-maintainer-mode, we all know about.

The other is a program called `missing'.  At configure time an
automake-using package looks for the standard (but frequently missing)
tools your package might use: autoconf, automake, etc.  If it exists,
fine.  If not, the program name as written into the Makefile is (eg)
"missing automake".

Then if your make tries to run automake, you get a helpful message
telling you what has gone wrong, and then the appropriate output files
are touched.  The idea here is that if you don't have automake then
you probably are just the victim of a losing system (eg, clock skew on
the network).

Here's the automake branch of `missing':

  automake)
    echo 1>&2 "\
WARNING: \`$1' is missing on your system.  You should only need it if
         you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'.
         You might want to install the \`Automake' and \`Perl' packages.
         Grab them from any GNU archive site."
    find . -type f -name Makefile.am -print \
      | sed 's/^\(.*\).am$/touch \1.in/' \
      | sh
    ;;


I don't much like the idea of --with-bison, --with-autoconf, etc.  I
run a pretty full system.  Typing a dozen --with- options just to make
the development environment work seems painful.

Tom
-- 
tromey@cygnus.com                 Member, League for Programming Freedom

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

* Re: explicitly initializing automatics with specific (garbage) values
  1997-08-24  3:43 egcs has some bad optimization bug H.J. Lu
  1997-08-24  3:43 ` Building of generated parser files Tom Tromey
@ 1997-08-24  3:43 ` Andi Kleen
  1 sibling, 0 replies; 4+ messages in thread
From: Andi Kleen @ 1997-08-24  3:43 UTC (permalink / raw)
  To: egcs

Jim Meyering <meyering@eng.ascend.com> writes:

> I vaguely recall someone suggesting adding an option to make gcc
> initialize automatic variables to some (maybe-specified) bit pattern.
> 
> I recall making good use of an option like this back when I
> worked with crusty old FORTRAN compilers.  I think it would be
> useful for C, too.
> 
> Does anyone have patches to do that?

Isn't -Wuninitialized enough for this?

-Andi

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

* Re: egcs has some bad optimization bug
@ 1997-08-24  4:24 Jim Wilson
  0 siblings, 0 replies; 4+ 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] 4+ messages in thread

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-08-24  3:43 egcs has some bad optimization bug H.J. Lu
1997-08-24  3:43 ` Building of generated parser files Tom Tromey
1997-08-24  3:43 ` explicitly initializing automatics with specific (garbage) values Andi Kleen
1997-08-24  4:24 egcs has some bad optimization bug Jim Wilson

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