This "spec bug" probably affects other targets too. I did search for "Unreachable" "statement" and came up ONE hit - unrelated: "Unreachable code at beginning of switch " http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25314
It seems that is a complicated issue that is interrelated with a few factors that are un-reported - so I will need to do some more debugging and focus this report on the problem with the spec file. If you don't want to "see the work" (proof?) just scroll to the end. --- I set out to try to do ONE thing - to try to find out why there were a few warnings during the compile of i686-pc-linux-gnu/libjava/... While trying to track down the cause I found a few interrelated problems. I prefer not to group together problems but keep them seperate but the 1st portion is more a "comment" about the problem with optimizing shutting off and the 2nd part is the "bug" I found while researching the problem. _THIS_ bug report is only on "Unreachable statement" turns off optimizing _AND_ spec file (or internal specs) are in error for gcc compiled with these parameters (a different bug report covers the boehm-gc): #gcc/xgcc -v Using built-in specs. Target: i686-pc-linux-gnu Configured with: /root/downloads/gcc-4_2-branch/configure --verbose --enable-languages=c,ada,c++,fortran,java,objc,obj-c++ --with-tune=athlon-xp --prefix=/usr --enable-objc-gc --enable-concept-checks --disable-multilib --with-gxx-include-dir=/usr/include/c++/4.2 --enable-libstdcxx-debug --enable-static --enable-shared --enable-initfini-array --enable-__cxa_atexit --enable-threads=posix --enable-version-specific-runtime-libs --enable-libssp --enable-libmudflap --enable-libgomp --disable-werror --enable-nls --with-included-gettext --enable-decimal-float --with-long-double-128 --enable-debug --enable-java-gc=boehm --with-x --x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib --enable-java-awt=gtk,xlib --enable-gtk-cairo --enable-qt-peer --enable-xmlj --enable-gconf-peer --enable-tool-wrappers --with-gjdoc --enable-portable-native-sync --enable-libgcj-multifile --with-stabs --enable-hash-synchronization --enable-gc-debug --enable-interpreter --with-system-zlib --enable-libada --with-tls --with-cpu=athlon-xp --with-arch=athlon-xp --enable-stage1-checking=assert,fold,gc,misc,rtl,rtlflag,runtime,tree Thread model: posix gcc version 4.2.1 20070515 (prerelease) --- Notes: --- When compiling "gcc version 4.2.1 20070515" I noticed that some warnings were occurring in the "i686-pc-linux-gnu/libjava/..." directories on a few files. Some of these warnings are "unused parameter" and some are "Unreachable statement". I wanted to see what the problem was ... I examined "natVMFrame.cc", "natVMVirtualMachine.cc", and "Base64.java" (shown below). I set out to examine the cause of these warnings. I am concerned about optimization and the warning "Unreachable statement" in file /root/downloads/gcc-4_2-branch/libjava/classpath/gnu/java/security/util/Base64.java since it is NOT true. The variable "outBuffPosn" is initialized in the event that len=0 and the loop gets skipped. If len!=0 (I suggest that is the most likely case) then the loop should not be skipped (thus we should not have a "warning: Unreachable statement." message). It concerns me that if the statement is unreachable then shouldn't the optimizer remove that section of the code (even with -O3, it doesn't) . If that section of code gets removed then the function would always return the same result - thus it could be inlined. Since GCC hit an "Unreachable statement" it gave up optimizing. The code seems well written. I would hate to see the code changed from: byte sbiCrop, sbiDecode; for (i = off; i < off + len; i++) to byte sbiCrop, sbiDecode; len++; for (i = off; i < off + (len-1); i++) Which, (of course), is stupid and doesn't work due to "final". Lets look at the screen output of the build for a moment: name=`echo classpath/lib/gnu/gcj/xlib/XImage.class | sed -e 's/\.class$//' -e 's,classpath/lib/,,'`; \ /root/downloads/gcc-4_2-branch/mkinstalldirs `dirname $name`; \ ./../.././gcc/gcjh -d . -classpath '' -bootclasspath classpath/lib $name name=`echo classpath/lib/gnu/gcj/xlib/XUnmapEvent.class | sed -e 's/\.class$//' -e 's,classpath/lib/,,'`; \ /root/downloads/gcc-4_2-branch/mkinstalldirs `dirname $name`; \ ./../.././gcc/gcjh -d . -classpath '' -bootclasspath classpath/lib $name make[4]: Leaving directory `/opt/gcc-4_2-build/i686-pc-linux-gnu/libjava' depbase=`echo jni-libjvm.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`; \ (...a dozen lines) depbase=`echo prims.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`; \ if /bin/sh ./libtool --mode=compile /opt/gcc-4_2-build/./gcc/xgcc -shared-libgcc -B/opt/gcc-4_2-build/./gcc -nostdinc++ -L/opt/gcc-4_2-build/i686-pc-linux-gnu/libstdc++-v3/src -L/opt/gcc-4_2-build/i686-pc-linux-gnu/libstdc++-v3/src/.libs -B/usr/i686-pc-linux-gnu/bin/ -B/usr/i686-pc-linux-gnu/lib/ -isystem /usr/i686-pc-linux-gnu/include -isystem /usr/i686-pc-linux-gnu/sys-include -DHAVE_CONFIG_H -I. -I/root/downloads/gcc-4_2-branch/libjava -I./include -I./gcj -I/root/downloads/gcc-4_2-branch/libjava -Iinclude -I/root/downloads/gcc-4_2-branch/libjava/include -I/root/downloads/gcc-4_2-branch/libjava/classpath/include -Iclasspath/include -I/root/downloads/gcc-4_2-branch/libjava/classpath/native/fdlibm -I/root/downloads/gcc-4_2-branch/libjava/../boehm-gc/include -I../boehm-gc/include -I/root/downloads/gcc-4_2-branch/libjava/libltdl -I/root/downloads/gcc-4_2-branch/libjava/libltdl -I/root/downloads/gcc-4_2-branch/libjava/.././libjava/../gcc -I/root/downloads/gcc-4_2-branch/libjava/../libffi/include -I../libffi/include -fno-rtti -fnon-call-exceptions -fdollars-in-identifiers -Wswitch-enum -D_FILE_OFFSET_BITS=64 -ffloat-store -fomit-frame-pointer -I/usr/X11R6/include -Wextra -Wall -D_GNU_SOURCE -DPREFIX="\"/usr\"" -DTOOLEXECLIBDIR="\"/usr/lib/gcc/i686-pc-linux-gnu/4.2.1\"" -DJAVA_HOME="\"/usr\"" -DBOOT_CLASS_PATH="\"/usr/share/java/libgcj-4.2.1.jar\"" -DJAVA_EXT_DIRS="\"/usr/share/java/ext\"" -DGCJ_ENDORSED_DIRS="\"/usr/share/java/gcj-endorsed\"" -DGCJ_VERSIONED_LIBDIR="\"/usr/lib/gcj-4.2.1\"" -DPATH_SEPARATOR="\":\"" -DLIBGCJ_DEFAULT_DATABASE="\"/usr/lib/gcj-4.2.1/classmap.db\"" -DLIBGCJ_DEFAULT_DATABASE_PATH_TAIL="\"gcj-4.2.1/classmap.db\"" -g -O2 -D_GNU_SOURCE -MT prims.lo -MD -MP -MF "$depbase.Tpo" -c -o prims.lo /root/downloads/gcc-4_2-branch/libjava/prims.cc; \ then mv -f "$depbase.Tpo" "$depbase.Plo"; else rm -f "$depbase.Tpo"; exit 1; fi /opt/gcc-4_2-build/./gcc/xgcc -shared-libgcc -B/opt/gcc-4_2-build/./gcc -nostdinc++ -L/opt/gcc-4_2-build/i686-pc-linux-gnu/libstdc++-v3/src -L/opt/gcc-4_2-build/i686-pc-linux-gnu/libstdc++-v3/src/.libs -B/usr/i686-pc-linux-gnu/bin/ -B/usr/i686-pc-linux-gnu/lib/ -isystem /usr/i686-pc-linux-gnu/include -isystem /usr/i686-pc-linux-gnu/sys-include -DHAVE_CONFIG_H -I. -I/root/downloads/gcc-4_2-branch/libjava -I./include -I./gcj -I/root/downloads/gcc-4_2-branch/libjava -Iinclude -I/root/downloads/gcc-4_2-branch/libjava/include -I/root/downloads/gcc-4_2-branch/libjava/classpath/include -Iclasspath/include -I/root/downloads/gcc-4_2-branch/libjava/classpath/native/fdlibm -I/root/downloads/gcc-4_2-branch/libjava/../boehm-gc/include -I../boehm-gc/include -I/root/downloads/gcc-4_2-branch/libjava/libltdl -I/root/downloads/gcc-4_2-branch/libjava/libltdl -I/root/downloads/gcc-4_2-branch/libjava/.././libjava/../gcc -I/root/downloads/gcc-4_2-branch/libjava/../libffi/include -I../libffi/include -fno-rtti -fnon-call-exceptions -fdollars-in-identifiers -Wswitch-enum -D_FILE_OFFSET_BITS=64 -ffloat-store -fomit-frame-pointer -I/usr/X11R6/include -Wextra -Wall -D_GNU_SOURCE -DPREFIX=\"/usr\" -DTOOLEXECLIBDIR=\"/usr/lib/gcc/i686-pc-linux-gnu/4.2.1\" -DJAVA_HOME=\"/usr\" -DBOOT_CLASS_PATH=\"/usr/share/java/libgcj-4.2.1.jar\" -DJAVA_EXT_DIRS=\"/usr/share/java/ext\" -DGCJ_ENDORSED_DIRS=\"/usr/share/java/gcj-endorsed\" -DGCJ_VERSIONED_LIBDIR=\"/usr/lib/gcj-4.2.1\" -DPATH_SEPARATOR=\":\" -DLIBGCJ_DEFAULT_DATABASE=\"/usr/lib/gcj-4.2.1/classmap.db\" -DLIBGCJ_DEFAULT_DATABASE_PATH_TAIL=\"gcj-4.2.1/classmap.db\" -g -O2 -D_GNU_SOURCE -MT prims.lo -MD -MP -MF .deps/prims.Tpo -c /root/downloads/gcc-4_2-branch/libjava/prims.cc -fPIC -DPIC -o .libs/prims.o /root/downloads/gcc-4_2-branch/libjava/prims.cc:107: warning: deprecated conversion from string constant to 'char*' /root/downloads/gcc-4_2-branch/libjava/prims.cc: In function 'void catch_fpe(int)': /root/downloads/gcc-4_2-branch/libjava/prims.cc:173: warning: dereferencing type-punned pointer will break strict-aliasing rules ./include/java-signal.h: At global scope: ./include/java-signal.h:112: warning: 'void restore()' declared 'static' but never defined /opt/gcc-4_2-build/./gcc/xgcc -shared-libgcc -B/opt/gcc-4_2-build/./gcc -nostdinc++ -L/opt/gcc-4_2-build/i686-pc-linux-gnu/libstdc++-v3/src -L/opt/gcc-4_2-build/i686-pc-linux-gnu/libstdc++-v3/src/.libs -B/usr/i686-pc-linux-gnu/bin/ -B/usr/i686-pc-linux-gnu/lib/ -isystem /usr/i686-pc-linux-gnu/include -isystem /usr/i686-pc-linux-gnu/sys-include -DHAVE_CONFIG_H -I. -I/root/downloads/gcc-4_2-branch/libjava -I./include -I./gcj -I/root/downloads/gcc-4_2-branch/libjava -Iinclude -I/root/downloads/gcc-4_2-branch/libjava/include -I/root/downloads/gcc-4_2-branch/libjava/classpath/include -Iclasspath/include -I/root/downloads/gcc-4_2-branch/libjava/classpath/native/fdlibm -I/root/downloads/gcc-4_2-branch/libjava/../boehm-gc/include -I../boehm-gc/include -I/root/downloads/gcc-4_2-branch/libjava/libltdl -I/root/downloads/gcc-4_2-branch/libjava/libltdl -I/root/downloads/gcc-4_2-branch/libjava/.././libjava/../gcc -I/root/downloads/gcc-4_2-branch/libjava/../libffi/include -I../libffi/include -fno-rtti -fnon-call-exceptions -fdollars-in-identifiers -Wswitch-enum -D_FILE_OFFSET_BITS=64 -ffloat-store -fomit-frame-pointer -I/usr/X11R6/include -Wextra -Wall -D_GNU_SOURCE -DPREFIX=\"/usr\" -DTOOLEXECLIBDIR=\"/usr/lib/gcc/i686-pc-linux-gnu/4.2.1\" -DJAVA_HOME=\"/usr\" -DBOOT_CLASS_PATH=\"/usr/share/java/libgcj-4.2.1.jar\" -DJAVA_EXT_DIRS=\"/usr/share/java/ext\" -DGCJ_ENDORSED_DIRS=\"/usr/share/java/gcj-endorsed\" -DGCJ_VERSIONED_LIBDIR=\"/usr/lib/gcj-4.2.1\" -DPATH_SEPARATOR=\":\" -DLIBGCJ_DEFAULT_DATABASE=\"/usr/lib/gcj-4.2.1/classmap.db\" -DLIBGCJ_DEFAULT_DATABASE_PATH_TAIL=\"gcj-4.2.1/classmap.db\" -g -O2 -D_GNU_SOURCE -MT prims.lo -MD -MP -MF .deps/prims.Tpo -c /root/downloads/gcc-4_2-branch/libjava/prims.cc -o prims.o >/dev/null 2>&1 depbase=`echo jni.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`; \ (...a dozen lines) mkdir gnu/classpath/.libs (...a few lines) mkdir gnu/classpath/jdwp/.libs /opt/gcc-4_2-build/./gcc/xgcc -shared-libgcc -B/opt/gcc-4_2-build/./gcc -nostdinc++ -L/opt/gcc-4_2-build/i686-pc-linux-gnu/libstdc++-v3/src -L/opt/gcc-4_2-build/i686-pc-linux-gnu/libstdc++-v3/src/.libs -B/usr/i686-pc-linux-gnu/bin/ -B/usr/i686-pc-linux-gnu/lib/ -isystem /usr/i686-pc-linux-gnu/include -isystem /usr/i686-pc-linux-gnu/sys-include -DHAVE_CONFIG_H -I. -I/root/downloads/gcc-4_2-branch/libjava -I./include -I./gcj -I/root/downloads/gcc-4_2-branch/libjava -Iinclude -I/root/downloads/gcc-4_2-branch/libjava/include -I/root/downloads/gcc-4_2-branch/libjava/classpath/include -Iclasspath/include -I/root/downloads/gcc-4_2-branch/libjava/classpath/native/fdlibm -I/root/downloads/gcc-4_2-branch/libjava/../boehm-gc/include -I../boehm-gc/include -I/root/downloads/gcc-4_2-branch/libjava/libltdl -I/root/downloads/gcc-4_2-branch/libjava/libltdl -I/root/downloads/gcc-4_2-branch/libjava/.././libjava/../gcc -I/root/downloads/gcc-4_2-branch/libjava/../libffi/include -I../libffi/include -fno-rtti -fnon-call-exceptions -fdollars-in-identifiers -Wswitch-enum -D_FILE_OFFSET_BITS=64 -ffloat-store -fomit-frame-pointer -I/usr/X11R6/include -Wextra -Wall -D_GNU_SOURCE -DPREFIX=\"/usr\" -DTOOLEXECLIBDIR=\"/usr/lib/gcc/i686-pc-linux-gnu/4.2.1\" -DJAVA_HOME=\"/usr\" -DBOOT_CLASS_PATH=\"/usr/share/java/libgcj-4.2.1.jar\" -DJAVA_EXT_DIRS=\"/usr/share/java/ext\" -DGCJ_ENDORSED_DIRS=\"/usr/share/java/gcj-endorsed\" -DGCJ_VERSIONED_LIBDIR=\"/usr/lib/gcj-4.2.1\" -DPATH_SEPARATOR=\":\" -DLIBGCJ_DEFAULT_DATABASE=\"/usr/lib/gcj-4.2.1/classmap.db\" -DLIBGCJ_DEFAULT_DATABASE_PATH_TAIL=\"gcj-4.2.1/classmap.db\" -g -O2 -D_GNU_SOURCE -MT gnu/classpath/jdwp/natVMFrame.lo -MD -MP -MF gnu/classpath/jdwp/.deps/natVMFrame.Tpo -c /root/downloads/gcc-4_2-branch/libjava/gnu/classpath/jdwp/natVMFrame.cc -fPIC -DPIC -o gnu/classpath/jdwp/.libs/natVMFrame.o /root/downloads/gcc-4_2-branch/libjava/gnu/classpath/jdwp/natVMFrame.cc:18: warning: unused parameter 'slot' /root/downloads/gcc-4_2-branch/libjava/gnu/classpath/jdwp/natVMFrame.cc:24: warning: unused parameter 'slot' /root/downloads/gcc-4_2-branch/libjava/gnu/classpath/jdwp/natVMFrame.cc:24: warning: unused parameter 'value' /opt/gcc-4_2-build/./gcc/xgcc -shared-libgcc -B/opt/gcc-4_2-build/./gcc -nostdinc++ -L/opt/gcc-4_2-build/i686-pc-linux-gnu/libstdc++-v3/src -L/opt/gcc-4_2-build/i686-pc-linux-gnu/libstdc++-v3/src/.libs -B/usr/i686-pc-linux-gnu/bin/ -B/usr/i686-pc-linux-gnu/lib/ -isystem /usr/i686-pc-linux-gnu/include -isystem /usr/i686-pc-linux-gnu/sys-include -DHAVE_CONFIG_H -I. -I/root/downloads/gcc-4_2-branch/libjava -I./include -I./gcj -I/root/downloads/gcc-4_2-branch/libjava -Iinclude -I/root/downloads/gcc-4_2-branch/libjava/include -I/root/downloads/gcc-4_2-branch/libjava/classpath/include -Iclasspath/include -I/root/downloads/gcc-4_2-branch/libjava/classpath/native/fdlibm -I/root/downloads/gcc-4_2-branch/libjava/../boehm-gc/include -I../boehm-gc/include -I/root/downloads/gcc-4_2-branch/libjava/libltdl -I/root/downloads/gcc-4_2-branch/libjava/libltdl -I/root/downloads/gcc-4_2-branch/libjava/.././libjava/../gcc -I/root/downloads/gcc-4_2-branch/libjava/../libffi/include -I../libffi/include -fno-rtti -fnon-call-exceptions -fdollars-in-identifiers -Wswitch-enum -D_FILE_OFFSET_BITS=64 -ffloat-store -fomit-frame-pointer -I/usr/X11R6/include -Wextra -Wall -D_GNU_SOURCE -DPREFIX=\"/usr\" -DTOOLEXECLIBDIR=\"/usr/lib/gcc/i686-pc-linux-gnu/4.2.1\" -DJAVA_HOME=\"/usr\" -DBOOT_CLASS_PATH=\"/usr/share/java/libgcj-4.2.1.jar\" -DJAVA_EXT_DIRS=\"/usr/share/java/ext\" -DGCJ_ENDORSED_DIRS=\"/usr/share/java/gcj-endorsed\" -DGCJ_VERSIONED_LIBDIR=\"/usr/lib/gcj-4.2.1\" -DPATH_SEPARATOR=\":\" -DLIBGCJ_DEFAULT_DATABASE=\"/usr/lib/gcj-4.2.1/classmap.db\" -DLIBGCJ_DEFAULT_DATABASE_PATH_TAIL=\"gcj-4.2.1/classmap.db\" -g -O2 -D_GNU_SOURCE -MT gnu/classpath/jdwp/natVMFrame.lo -MD -MP -MF gnu/classpath/jdwp/.deps/natVMFrame.Tpo -c /root/downloads/gcc-4_2-branch/libjava/gnu/classpath/jdwp/natVMFrame.cc -o gnu/classpath/jdwp/natVMFrame.o >/dev/null 2>&1 (...a few lines) depbase=`echo gnu/classpath/jdwp/natVMVirtualMachine.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`; \ if /bin/sh ./libtool --mode=compile /opt/gcc-4_2-build/./gcc/xgcc -shared-libgcc -B/opt/gcc-4_2-build/./gcc -nostdinc++ -L/opt/gcc-4_2-build/i686-pc-linux-gnu/libstdc++-v3/src -L/opt/gcc-4_2-build/i686-pc-linux-gnu/libstdc++-v3/src/.libs -B/usr/i686-pc-linux-gnu/bin/ -B/usr/i686-pc-linux-gnu/lib/ -isystem /usr/i686-pc-linux-gnu/include -isystem /usr/i686-pc-linux-gnu/sys-include -DHAVE_CONFIG_H -I. -I/root/downloads/gcc-4_2-branch/libjava -I./include -I./gcj -I/root/downloads/gcc-4_2-branch/libjava -Iinclude -I/root/downloads/gcc-4_2-branch/libjava/include -I/root/downloads/gcc-4_2-branch/libjava/classpath/include -Iclasspath/include -I/root/downloads/gcc-4_2-branch/libjava/classpath/native/fdlibm -I/root/downloads/gcc-4_2-branch/libjava/../boehm-gc/include -I../boehm-gc/include -I/root/downloads/gcc-4_2-branch/libjava/libltdl -I/root/downloads/gcc-4_2-branch/libjava/libltdl -I/root/downloads/gcc-4_2-branch/libjava/.././libjava/../gcc -I/root/downloads/gcc-4_2-branch/libjava/../libffi/include -I../libffi/include -fno-rtti -fnon-call-exceptions -fdollars-in-identifiers -Wswitch-enum -D_FILE_OFFSET_BITS=64 -ffloat-store -fomit-frame-pointer -I/usr/X11R6/include -Wextra -Wall -D_GNU_SOURCE -DPREFIX="\"/usr\"" -DTOOLEXECLIBDIR="\"/usr/lib/gcc/i686-pc-linux-gnu/4.2.1\"" -DJAVA_HOME="\"/usr\"" -DBOOT_CLASS_PATH="\"/usr/share/java/libgcj-4.2.1.jar\"" -DJAVA_EXT_DIRS="\"/usr/share/java/ext\"" -DGCJ_ENDORSED_DIRS="\"/usr/share/java/gcj-endorsed\"" -DGCJ_VERSIONED_LIBDIR="\"/usr/lib/gcj-4.2.1\"" -DPATH_SEPARATOR="\":\"" -DLIBGCJ_DEFAULT_DATABASE="\"/usr/lib/gcj-4.2.1/classmap.db\"" -DLIBGCJ_DEFAULT_DATABASE_PATH_TAIL="\"gcj-4.2.1/classmap.db\"" -g -O2 -D_GNU_SOURCE -MT gnu/classpath/jdwp/natVMVirtualMachine.lo -MD -MP -MF "$depbase.Tpo" -c -o gnu/classpath/jdwp/natVMVirtualMachine.lo /root/downloads/gcc-4_2-branch/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc; \ then mv -f "$depbase.Tpo" "$depbase.Plo"; else rm -f "$depbase.Tpo"; exit 1; fi /opt/gcc-4_2-build/./gcc/xgcc -shared-libgcc -B/opt/gcc-4_2-build/./gcc -nostdinc++ -L/opt/gcc-4_2-build/i686-pc-linux-gnu/libstdc++-v3/src -L/opt/gcc-4_2-build/i686-pc-linux-gnu/libstdc++-v3/src/.libs -B/usr/i686-pc-linux-gnu/bin/ -B/usr/i686-pc-linux-gnu/lib/ -isystem /usr/i686-pc-linux-gnu/include -isystem /usr/i686-pc-linux-gnu/sys-include -DHAVE_CONFIG_H -I. -I/root/downloads/gcc-4_2-branch/libjava -I./include -I./gcj -I/root/downloads/gcc-4_2-branch/libjava -Iinclude -I/root/downloads/gcc-4_2-branch/libjava/include -I/root/downloads/gcc-4_2-branch/libjava/classpath/include -Iclasspath/include -I/root/downloads/gcc-4_2-branch/libjava/classpath/native/fdlibm -I/root/downloads/gcc-4_2-branch/libjava/../boehm-gc/include -I../boehm-gc/include -I/root/downloads/gcc-4_2-branch/libjava/libltdl -I/root/downloads/gcc-4_2-branch/libjava/libltdl -I/root/downloads/gcc-4_2-branch/libjava/.././libjava/../gcc -I/root/downloads/gcc-4_2-branch/libjava/../libffi/include -I../libffi/include -fno-rtti -fnon-call-exceptions -fdollars-in-identifiers -Wswitch-enum -D_FILE_OFFSET_BITS=64 -ffloat-store -fomit-frame-pointer -I/usr/X11R6/include -Wextra -Wall -D_GNU_SOURCE -DPREFIX=\"/usr\" -DTOOLEXECLIBDIR=\"/usr/lib/gcc/i686-pc-linux-gnu/4.2.1\" -DJAVA_HOME=\"/usr\" -DBOOT_CLASS_PATH=\"/usr/share/java/libgcj-4.2.1.jar\" -DJAVA_EXT_DIRS=\"/usr/share/java/ext\" -DGCJ_ENDORSED_DIRS=\"/usr/share/java/gcj-endorsed\" -DGCJ_VERSIONED_LIBDIR=\"/usr/lib/gcj-4.2.1\" -DPATH_SEPARATOR=\":\" -DLIBGCJ_DEFAULT_DATABASE=\"/usr/lib/gcj-4.2.1/classmap.db\" -DLIBGCJ_DEFAULT_DATABASE_PATH_TAIL=\"gcj-4.2.1/classmap.db\" -g -O2 -D_GNU_SOURCE -MT gnu/classpath/jdwp/natVMVirtualMachine.lo -MD -MP -MF gnu/classpath/jdwp/.deps/natVMVirtualMachine.Tpo -c /root/downloads/gcc-4_2-branch/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc -fPIC -DPIC -o gnu/classpath/jdwp/.libs/natVMVirtualMachine.o /root/downloads/gcc-4_2-branch/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc: In static member function 'static void gnu::classpath::jdwp::VMVirtualMachine::initialize()': /root/downloads/gcc-4_2-branch/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc:46: warning: dereferencing type-punned pointer will break strict-aliasing rules /root/downloads/gcc-4_2-branch/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc: At global scope: /root/downloads/gcc-4_2-branch/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc:265: warning: unused parameter 'kind' /root/downloads/gcc-4_2-branch/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc:282: warning: unused parameter 'klass' /root/downloads/gcc-4_2-branch/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc:288: warning: unused parameter 'klass' /root/downloads/gcc-4_2-branch/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc:294: warning: unused parameter 'klass' /root/downloads/gcc-4_2-branch/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc:294: warning: unused parameter 'id' /root/downloads/gcc-4_2-branch/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc:302: warning: unused parameter 'thread' /root/downloads/gcc-4_2-branch/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc:302: warning: unused parameter 'start' /root/downloads/gcc-4_2-branch/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc:302: warning: unused parameter 'length' /root/downloads/gcc-4_2-branch/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc:309: warning: unused parameter 'thread' /root/downloads/gcc-4_2-branch/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc:309: warning: unused parameter 'bb' /root/downloads/gcc-4_2-branch/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc:315: warning: unused parameter 'thread' /root/downloads/gcc-4_2-branch/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc:321: warning: unused parameter 'thread' /root/downloads/gcc-4_2-branch/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc:327: warning: unused parameter 'cl' /root/downloads/gcc-4_2-branch/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc:338: warning: unused parameter 'obj' /root/downloads/gcc-4_2-branch/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc:338: warning: unused parameter 'thread' /root/downloads/gcc-4_2-branch/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc:338: warning: unused parameter 'clazz' /root/downloads/gcc-4_2-branch/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc:338: warning: unused parameter 'method' /root/downloads/gcc-4_2-branch/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc:338: warning: unused parameter 'values' /root/downloads/gcc-4_2-branch/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc:338: warning: unused parameter 'nonVirtual' /root/downloads/gcc-4_2-branch/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc:344: warning: unused parameter 'clazz' /opt/gcc-4_2-build/./gcc/xgcc -shared-libgcc -B/opt/gcc-4_2-build/./gcc -nostdinc++ -L/opt/gcc-4_2-build/i686-pc-linux-gnu/libstdc++-v3/src -L/opt/gcc-4_2-build/i686-pc-linux-gnu/libstdc++-v3/src/.libs -B/usr/i686-pc-linux-gnu/bin/ -B/usr/i686-pc-linux-gnu/lib/ -isystem /usr/i686-pc-linux-gnu/include -isystem /usr/i686-pc-linux-gnu/sys-include -DHAVE_CONFIG_H -I. -I/root/downloads/gcc-4_2-branch/libjava -I./include -I./gcj -I/root/downloads/gcc-4_2-branch/libjava -Iinclude -I/root/downloads/gcc-4_2-branch/libjava/include -I/root/downloads/gcc-4_2-branch/libjava/classpath/include -Iclasspath/include -I/root/downloads/gcc-4_2-branch/libjava/classpath/native/fdlibm -I/root/downloads/gcc-4_2-branch/libjava/../boehm-gc/include -I../boehm-gc/include -I/root/downloads/gcc-4_2-branch/libjava/libltdl -I/root/downloads/gcc-4_2-branch/libjava/libltdl -I/root/downloads/gcc-4_2-branch/libjava/.././libjava/../gcc -I/root/downloads/gcc-4_2-branch/libjava/../libffi/include -I../libffi/include -fno-rtti -fnon-call-exceptions -fdollars-in-identifiers -Wswitch-enum -D_FILE_OFFSET_BITS=64 -ffloat-store -fomit-frame-pointer -I/usr/X11R6/include -Wextra -Wall -D_GNU_SOURCE -DPREFIX=\"/usr\" -DTOOLEXECLIBDIR=\"/usr/lib/gcc/i686-pc-linux-gnu/4.2.1\" -DJAVA_HOME=\"/usr\" -DBOOT_CLASS_PATH=\"/usr/share/java/libgcj-4.2.1.jar\" -DJAVA_EXT_DIRS=\"/usr/share/java/ext\" -DGCJ_ENDORSED_DIRS=\"/usr/share/java/gcj-endorsed\" -DGCJ_VERSIONED_LIBDIR=\"/usr/lib/gcj-4.2.1\" -DPATH_SEPARATOR=\":\" -DLIBGCJ_DEFAULT_DATABASE=\"/usr/lib/gcj-4.2.1/classmap.db\" -DLIBGCJ_DEFAULT_DATABASE_PATH_TAIL=\"gcj-4.2.1/classmap.db\" -g -O2 -D_GNU_SOURCE -MT gnu/classpath/jdwp/natVMVirtualMachine.lo -MD -MP -MF gnu/classpath/jdwp/.deps/natVMVirtualMachine.Tpo -c /root/downloads/gcc-4_2-branch/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc -o gnu/classpath/jdwp/natVMVirtualMachine.o >/dev/null 2>&1 depbase=`echo gnu/gcj/natCore.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`; \ ...(many lines) mkdir gnu/java/security/sig/.libs ...(a 1/2 dozen lines) /bin/sh ./libtool --mode=compile /opt/gcc-4_2-build/gcc/gcj -B/opt/gcc-4_2-build/i686-pc-linux-gnu/libjava/ -B/opt/gcc-4_2-build/gcc/ -ffloat-store -fomit-frame-pointer -fclasspath= -fbootclasspath=/opt/gcc-4_2-build/i686-pc-linux-gnu/libjava/classpath/lib --encoding=UTF-8 -Wno-deprecated -fbootstrap-classes -g -O2 -c -o gnu/java/security/util.lo -MT gnu/java/security/util.lo -MD -MP -MF gnu/java/security/util.deps @gnu/java/security/util.list /opt/gcc-4_2-build/gcc/gcj -B/opt/gcc-4_2-build/i686-pc-linux-gnu/libjava/ -B/opt/gcc-4_2-build/gcc/ -ffloat-store -fomit-frame-pointer -fclasspath= -fbootclasspath=/opt/gcc-4_2-build/i686-pc-linux-gnu/libjava/classpath/lib --encoding=UTF-8 -Wno-deprecated -fbootstrap-classes -g -O2 -c -MT gnu/java/security/util.lo -MD -MP -MF gnu/java/security/util.deps @gnu/java/security/util.list -fPIC -o gnu/java/security/.libs/util.o /root/downloads/gcc-4_2-branch/libjava/classpath/gnu/java/security/util/Base64.java: In class 'gnu.java.security.util.Base64': /root/downloads/gcc-4_2-branch/libjava/classpath/gnu/java/security/util/Base64.java: In method 'gnu.java.security.util.Base64.decode(byte[],int,int)': /root/downloads/gcc-4_2-branch/libjava/classpath/gnu/java/security/util/Base64.java:200: warning: Unreachable statement. for (i = off; i < off + len; i++) ^ 1 warning /opt/gcc-4_2-build/gcc/gcj -B/opt/gcc-4_2-build/i686-pc-linux-gnu/libjava/ -B/opt/gcc-4_2-build/gcc/ -ffloat-store -fomit-frame-pointer -fclasspath= -fbootclasspath=/opt/gcc-4_2-build/i686-pc-linux-gnu/libjava/classpath/lib --encoding=UTF-8 -Wno-deprecated -fbootstrap-classes -g -O2 -c -MT gnu/java/security/util.lo -MD -MP -MF gnu/java/security/util.deps @gnu/java/security/util.list -o gnu/java/security/util.o >/dev/null 2>&1 /bin/sh ./libtool --mode=compile /opt/gcc-4_2-build/gcc/gcj -B/opt/gcc-4_2-build/i686-pc-linux-gnu/libjava/ -B/opt/gcc-4_2-build/gcc/ -ffloat-store -fomit-frame-pointer -fclasspath= -fbootclasspath=/opt/gcc-4_2-build/i686-pc-linux-gnu/libjava/classpath/lib --encoding=UTF-8 -Wno-deprecated -fbootstrap-classes -g -O2 -c -o gnu/java/security/x509.lo -MT gnu/java/security/x509.lo -MD -MP -MF gnu/java/security/x509.deps @gnu/java/security/x509.list File: /root/downloads/gcc-4_2-branch/libjava/classpath/gnu/java/security/util/Base64.java /** * Decodes Base64 content in byte array format and returns the decoded byte * array. * * @param src the Base64 encoded data. * @param off the offset of where to begin decoding. * @param len the length of characters to decode. * @return the decoded data. * @throws IllegalArgumentException if <code>src</code> contains an illegal * Base-64 character. */ public static byte[] decode(final byte[] src, final int off, final int len) { final int len34 = len * 3 / 4; final byte[] outBuff = new byte[len34]; // Upper limit on size of output int outBuffPosn = 0; final byte[] b4 = new byte[4]; int b4Posn = 0; int i; byte sbiCrop, sbiDecode; for (i = off; i < off + len; i++) { sbiCrop = (byte) (src[i] & 0x7F); // Only the low seven bits sbiDecode = DECODABET[sbiCrop]; if (sbiDecode >= WHITE_SPACE_ENC) { // White space, Equals sign or better if (sbiDecode >= EQUALS_SIGN_ENC) { b4[b4Posn++] = sbiCrop; if (b4Posn > 3) { outBuffPosn += decode4to3(b4, 0, outBuff, outBuffPosn); b4Posn = 0; // If that was the equals sign, break out of 'for' loop if (sbiCrop == EQUALS_SIGN) break; } // end if: quartet built } // end if: equals sign or better } throw new IllegalArgumentException("Illegal BASE-64 character at #" + i + ": " + src[i] + "(decimal)"); } final byte[] result = new byte[outBuffPosn]; System.arraycopy(outBuff, 0, result, 0, outBuffPosn); return result; } Either of the following two commands can be ran in _my_ base of the build directory to compile the file Base64.java and place the output in the base build directory (so as not to overwrite anything). This works for _me_, _you_ need to edit for your setup. /bin/sh ./i686-pc-linux-gnu/libjava/libtool --mode=compile /opt/gcc-4_2-build/gcc/gcj -B/opt/gcc-4_2-build/i686-pc-linux-gnu/libjava/ -B/opt/gcc-4_2-build/gcc/ -ffloat-store -fomit-frame-pointer -fclasspath= -fbootclasspath=/opt/gcc-4_2-build/i686-pc-linux-gnu/libjava/classpath/lib --encoding=UTF-8 -Wno-deprecated -fbootstrap-classes -g -O2 -c -o Base64.lo -MT Base64.lo -MD -MP -MF Base64.deps /root/downloads/gcc-4_2-branch/libjava/classpath/gnu/java/security/util/Base64.java /opt/gcc-4_2-build/gcc/gcj -B/opt/gcc-4_2-build/i686-pc-linux-gnu/libjava/ -B/opt/gcc-4_2-build/gcc/ -ffloat-store -fomit-frame-pointer -fclasspath= -fbootclasspath=/opt/gcc-4_2-build/i686-pc-linux-gnu/libjava/classpath/lib --encoding=UTF-8 -Wno-deprecated -fbootstrap-classes -g -O2 -c -MT gnu/java/security/util.lo -MD -MP -MF Base64.deps /root/downloads/gcc-4_2-branch/libjava/classpath/gnu/java/security/util/Base64.java -fPIC -o Base64.o Output: /root/downloads/gcc-4_2-branch/libjava/classpath/gnu/java/security/util/Base64.java: In class 'gnu.java.security.util.Base64': /root/downloads/gcc-4_2-branch/libjava/classpath/gnu/java/security/util/Base64.java: In method 'gnu.java.security.util.Base64.decode(byte[],int,int)': /root/downloads/gcc-4_2-branch/libjava/classpath/gnu/java/security/util/Base64.java:200: warning: Unreachable statement. for (i = off; i < off + len; i++) ^ 1 warning --- That led me to discover the "spec" issue. I don't expect the above will be solved soon but the spec problem is not too hard to fix. --- There is more than one way to compile the file. It is "legal" to use gcc on ".java" files since gcc will run the correct program for you (if the specs file is correct). GCJ: #/opt/gcc-4_2-build/gcc/gcj -v ... /opt/gcc-4_2-build/gcc/jc1 /root/downloads/gcc-4_2-branch/libjava/classpath/gnu/java/security/util/Base64.java -fhash-synchronization -fno-use-divide-subroutine -fuse-boehm-gc -fnon-call-exceptions -fkeep-inline-functions -quiet -dumpbase Base64.java -mtune=athlon-xp -march=athlon-xp -auxbase-strip Base64.o -g -O2 -Wno-deprecated -version -ffloat-store -fomit-frame-pointer -fclasspath= -fbootclasspath=/opt/gcc-4_2-build/i686-pc-linux-gnu/libjava/classpath/lib -fencoding=UTF-8 -fbootstrap-classes -fPIC -MD_ -MT gnu/java/security/util.lo -MF Base64.deps -o /tmp/ccEkj5JG.s GCC: #/opt/gcc-4_2-build/gcc/xgcc -v ... /opt/gcc-4_2-build/gcc/jc1 /root/downloads/gcc-4_2-branch/libjava/classpath/gnu/java/security/util/Base64.java -quiet -dumpbase Base64.java -mtune=athlon-xp -march=athlon-xp -auxbase-strip Base64.o -g -O2 -Wno-deprecated -version -ffloat-store -fomit-frame-pointer -fclasspath= -fbootclasspath=/opt/gcc-4_2-build/i686-pc-linux-gnu/libjava/classpath/lib -fencoding=UTF-8 -fbootstrap-classes -fPIC -MD_ -MT gnu/java/security/util.lo -MF Base64.deps -o /tmp/ccWfMiuA.s It seems xgcc chooses different commands for jc1 than gcj would use. Lets try it anyways. When I use xgcc to process the file here is what happens: #/opt/gcc-4_2-build/gcc/xgcc -B/opt/gcc-4_2-build/i686-pc-linux-gnu/libjava/ -B/opt/gcc-4_2-build/gcc/ -ffloat-store -fomit-frame-pointer -fclasspath= -fbootclasspath=/opt/gcc-4_2-build/i686-pc-linux-gnu/libjava/classpath/lib --encoding=UTF-8 -Wno-deprecated -fbootstrap-classes -g -O2 -c -MT gnu/java/security/util.lo -MD -MP -MF Base64.deps /root/downloads/gcc-4_2-branch/libjava/classpath/gnu/java/security/util/Base64.java -fPIC -o Base64.o Base64.java: In class 'gnu.java.security.util.Base64': Base64.java: In method 'gnu.java.security.util.Base64.decode(byte[],int,int)': Base64.java:200: warning: Unreachable statement. for (i = off; i < off + len; i++) ^ 1 warning Base64.java: At top level: Base64.java:50: internal compiler error: in uses_jv_markobj_p, at java/boehm.c:245 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. Curious, doing that gives the same warning in the same location, but triggers an ICE. It would seem there is a sore spot when gcc runs into that sort of code. Someone else might want to shorten that Java code and make a testcase. I am not expert enough with Java or I would offer something. I tried that on gcc-4.1 to see what would happen: # gcc-4.1 -v -O0 -c Base64.java -o Base64.o 2>&1 | grep internal Base64.java:50: internal compiler error: in uses_jv_markobj_p, at java/boehm.c:245 # gcc-4.1 -fuse-boehm-gc -v -O0 -c Base64.java -o Base64.o 2>&1 | grep internal # (nothing printed) It would seem that the spec file needs "-fuse-boehm-gc" added to it so gcc can compile Java and avoid the error message "internal compiler error: in uses_jv_markobj_p, at java/boehm.c:245" That led me to discover that boehm-gc _might_ have some trouble - it certainly makes debugging much harder. The boehm-gc issue is the subject of a different bug report. (It will be somewhere a few bug #'s higher than this one). The file: /root/downloads/gcc-4_2-branch/gcc/java/boehm.c has a FIXME at 245. /* The fourth (index of 3) element in the vtable is the GC descriptor. A value of 2 indicates that the class uses _Jv_MarkObj. */ bool uses_jv_markobj_p (tree dtable) { tree v; /* FIXME: what do we return if !flag_use_boehm_gc ? */ gcc_assert (flag_use_boehm_gc); /* FIXME: this is wrong if TARGET_VTABLE_USES_DESCRIPTORS. However, this function is only used with flag_reduced_reflection. No point in asserting unless we hit the bad case. */ gcc_assert (!flag_reduced_reflection || TARGET_VTABLE_USES_DESCRIPTORS == 0); v = VEC_index (constructor_elt, CONSTRUCTOR_ELTS (dtable), 3)->value; return (PROCEDURE_OBJECT_DESCRIPTOR == TREE_INT_CST_LOW (v)); } --- Short version (with no proof): The lack of "-fuse-boehm-gc" in the spec file (or the internal spec) is triggering the "gcc_assert()" in boehm.c at line 245. This occurs when gcc is built with the above ./configure options (likely --enable-java-gc=boehm) and used to compile a file with a ".java" extension. -- Summary: Incorrect "Unreachable statement" turns off optimizing + spec file in error Product: gcc Version: 4.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: bootstrap AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: rob1weld at aol dot com GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31998