[gnu.gcc.bug] gcc 1.33 doesn't compile itself with stage2/gcc on a sun4os4 and -O

ekrell@ulysses.att.com (02/04/89)

On a sun4os4 configuration, if you change CFLAGS in the Makefile to -O
instead of -g, cc1 coredumps in the last stage (when you run
make CC=stage2/gcc CFLAGS="-O -Bstage2/") on the file toplev.c.

Without the -O it bootstraps ok, so I guess this is a bug in the
optimizer.

rms@WHEATIES.AI.MIT.EDU (Richard Stallman) (02/04/89)

    On a sun4os4 configuration, if you change CFLAGS in the Makefile to -O
    instead of -g, cc1 coredumps in the last stage (when you run
    make CC=stage2/gcc CFLAGS="-O -Bstage2/") on the file toplev.c.

Either I don't understand you, or you have described a change which
has no effect.  Specifying -O twice is the same as specifying it once.

kcwellsch@watmath.waterloo.edu (Ken Wellsch) (02/04/89)

>    On a sun4os4 configuration, if you change CFLAGS in the Makefile to -O
>    instead of -g, cc1 coredumps in the last stage (when you run
>    make CC=stage2/gcc CFLAGS="-O -Bstage2/") on the file toplev.c.

I expect you are changing the "-g" to a "-O" on the first "make"
compilation step in compiling gcc which uses the native "cc".  Don't.

Another software person here discovered that it wasn't very hard to find
examples of C code that when compiled using the stock "cc" on sun4-os4
WITH optimization, it produce WRONG code.  We were really impressed with
the code generated with gcc-1.32.  BTW: it was not wrong on the samples
he found failed with "cc -O".

ekrell@ulysses.att.com (02/04/89)

Let me explain myself. The Makefile distributed with gcc 1.33 uses CFLAGS=-g.
I changed this line to CFLAGS=-O. Then I run:

make
make stage1
make CC=stage1/gcc CFLAGS="-O -Bstage1/"
rm -fr stage1
make stage2
make CC=stage2/gcc CFLAGS="-O -Bstage2/"

at this point, I get a core dump from stage2/cc1 when compiling "toplev.c".

If I repeat this process without the -O, ie, CFLAGS= in the Makefile, and

make
make stage1
make CC=stage1/gcc CFLAGS=-Bstage1/
rm -fr stage1
make stage2
make CC=stage2/gcc CFLAGS=-Bstage2/

Then I don't get any core dump and the *.o files compare ok with the ones
in stage2/*.o

My interpretation of this is that the "stage1/gcc -O" phase generates
bad code which makes stage2/cc1 core dump on toplev.c.