This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug optimization/12082] Inappropriate unreachable code warnings
- From: "augart at us dot ibm dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 28 Aug 2003 17:25:50 -0000
- Subject: [Bug optimization/12082] Inappropriate unreachable code warnings
- References: <20030827203936.12082.augart@us.ibm.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12082
------- Additional Comments From augart at us dot ibm dot com 2003-08-28 17:25 -------
I have found a smaller test case that shows the bug (down to 36 lines including
7 blank lines).
I am attaching "bad1.i", a preprocessed C file that triggers the warning.
Here is the output from compiling bad1.i with gcc 3.3.1:
bilbo:~/JikesRVM/gccbug > cc --save-temps -v -Wunreachable-code -O3 -o bad1.S -S
bad1.i
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/specs
Configured with: ./configure --cache-file=config.cache
Thread model: posix
gcc version 3.3.1
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/cc1 -fpreprocessed bad1.i -quiet
-dumpbase bad1.i -auxbase-strip bad1.S -O3 -Wunreachable-code -version -o bad1.S
GNU C version 3.3.1 (i686-pc-linux-gnu)
compiled by GNU C version 3.3.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
bad1.c: In function `main':
bad1.c:13: warning: will never be executed
bilbo:~/JikesRVM/gccbug >
The bug does not appear when I compile the very similar source file good1.c:
bilbo:~/JikesRVM/gccbug > cc --save-temps -v -Wunreachable-code -O3 -o good1.S
-S good1.i
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/specs
Configured with: ./configure --cache-file=config.cache
Thread model: posix
gcc version 3.3.1
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/cc1 -fpreprocessed good1.i
-quiet -dumpbase good1.i -auxbase-strip good1.S -O3 -Wunreachable-code -version
-o good1.S
GNU C version 3.3.1 (i686-pc-linux-gnu)
compiled by GNU C version 3.3.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
bilbo:~/JikesRVM/gccbug >
Nor does it appear when I compile good2.i, which is bad1.i without the for loop:
bilbo:~/JikesRVM/gccbug > cc --save-temps -v -Wunreachable-code -O3 -o good2.S
-S good2.i
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/specs
Configured with: ./configure --cache-file=config.cache
Thread model: posix
gcc version 3.3.1
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/cc1 -fpreprocessed good2.i
-quiet -dumpbase good2.i -auxbase-strip good2.S -O3 -Wunreachable-code -version
-o good2.S
GNU C version 3.3.1 (i686-pc-linux-gnu)
compiled by GNU C version 3.3.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
bilbo:~/JikesRVM/gccbug >