-O2 noncompile/971104-1.c aborts, we should test noncompile w/opts
Kaveh R. Ghazi
ghazi@caip.rutgers.edu
Tue Jun 15 16:51:00 GMT 1999
I happened to notice that the egcs testsuite does not appear
to run the gcc.c-torture/noncompile tests with various optimizations
(like the old c-torture did). I guess this is under the assumption
that we're simply testing if the compiler's parser catches bogus code.
But we lose making sure the compiler does not crash at various -O#
levels. So I tried them out by hand with -O2 and one of the tests
aborted. See below:
> % tgcc -v
> Reading specs from /var/tmp/gcc-testing/build/gcc/specs
> gcc version gcc-2.96 19990614 (experimental)
> % tgcc -O2 noncompile/971104-1.c
> noncompile/971104-1.c: In function `up':
> noncompile/971104-1.c:25: parse error before `}'
> xgcc: Internal compiler error: program cc1 got fatal signal 11
Here's what gdb said:
> GNU gdb 4.17
> Copyright 1998 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and you are
> welcome to change it and/or distribute copies of it under certain conditions.
> Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB. Type "show warranty" for details.
> This GDB was configured as "sparc-sun-solaris2.7"...
> Core was generated by `/var/tmp/gcc-testing/build/gcc/cc1
> /var/tmp/cca5faaa.i -quiet -dumpbase 971104-'.
> Program terminated with signal 11, Segmentation Fault.
> Reading symbols from /usr/lib/libc.so.1...done.
> Reading symbols from /usr/lib/libdl.so.1...done.
> Reading symbols from /usr/platform/SUNW,Ultra-2/lib/libc_psr.so.1...done.
> #0 make_edge (src=0x270050, dst=0x0, flags=0)
> at ../../egcs-CVS19990614/gcc/flow.c:1079
> 1079 e->pred_next = dst->pred;
> (gdb) where
> #0 make_edge (src=0x270050, dst=0x0, flags=0)
> at ../../egcs-CVS19990614/gcc/flow.c:1079
> #1 0x10e648 in make_label_edge (src=0x270050, label=0x26c228, flags=0)
> at ../../egcs-CVS19990614/gcc/flow.c:1107
> #2 0x10e32c in make_edges (label_value_list=0x0, bb_eh_end=0xffbeef88)
> at ../../egcs-CVS19990614/gcc/flow.c:968
> #3 0x10d810 in find_basic_blocks (f=0x252138, nregs=127, file=0x0,
> do_cleanup=1) at ../../egcs-CVS19990614/gcc/flow.c:405
> #4 0xd660c in gcse_main (f=0x252138, file=0x0)
> at ../../egcs-CVS19990614/gcc/gcse.c:648
> #5 0x3a074 in rest_of_compilation (decl=0x26b2d0)
> at ../../egcs-CVS19990614/gcc/toplev.c:3907
> #6 0x1cde1c in finish_function (nested=0)
> at ../../egcs-CVS19990614/gcc/c-decl.c:7268
> #7 0x1ba01c in yyparse () at c-parse.y:313
> #8 0x38c48 in compile_file (name=0xffbef9e3 "/var/tmp/cca5faaa.i")
> at ../../egcs-CVS19990614/gcc/toplev.c:3265
> #9 0x3c944 in main (argc=8, argv=0xffbef844)
> at ../../egcs-CVS19990614/gcc/toplev.c:5441
So it looks like cc1 dies because it dereferences a NULL ptr.
Besides reporting the bug itself, I wanted to suggest that we have the
noncompile directory run through the opt levels. There aren't that
many of these tests so it won't make the suite take much more time to
run. (Though I'm not sure exactly how to do it. Pointers
appreciated, and then I'll take care of making a patch.)
--Kaveh
--
Kaveh R. Ghazi Engagement Manager / Project Services
ghazi@caip.rutgers.edu Qwest Internet Solutions
More information about the Gcc-bugs
mailing list