http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57147
Bug #: 57147 Summary: [4.9 Regression]: setjmp call and if body wrongly elided (function runs off early end) Classification: Unclassified Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassig...@gcc.gnu.org ReportedBy: rol...@gnu.org Target: arm-linux-gnueabi Created attachment 30006 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30006 preprocessed source This is with trunk@198549. It's a regression from gcc-4_8-branch@198420. Preprocessed source attached. Configured as: --target=arm-linux-gnueabi --with-arch=armv7-a Command line below. This example is not expected to be usable on an arm-linux-gnueabi system, but the problem is easily seen by examining the assembly. In the function TestSyscall, a good compilation calls _setjmp, returns normally on a nonzero result, and ends in an __assert_fail call (a noreturn function, so no epilogue/return after the call) on a zero result. In a bad compilation, the function just ends where the _setjmp call should be, no epilogue, no return (so execution just runs into the following function). gcc/cc1 -v -fpreprocessed syscall_return_regs_test.i -quiet -dumpbase syscall_return_regs_test.c -mtls-dialect=gnu -auxbase-strip scons-out/nacl_irt_test-arm-glibc/obj/tests/syscall_return_regs/syscall_return_regs_test.o -g -O2 -Wstrict-prototypes -Wall -Wundef -Wpedantic -Werror -Wno-variadic-macros -Wno-unused-local-typedefs -std=gnu99 -version -fomit-frame-pointer -fdiagnostics-show-option -o syscall_return_regs_test.s GNU C (GCC) version 4.9.0 20130502 (experimental) (arm-linux-gnueabi) compiled by GNU C version 4.6.3, GMP version 5.0.2, MPFR version 3.1.0-p3, MPC version 0.9 GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 ignoring nonexistent directory "/usr/local/google/home/mcgrathr/gnu/build/inst/lib/gcc/arm-linux-gnueabi/4.9.0/include" ignoring nonexistent directory "/usr/local/google/home/mcgrathr/gnu/build/inst/lib/gcc/arm-linux-gnueabi/4.9.0/include-fixed" ignoring nonexistent directory "/usr/local/google/home/mcgrathr/gnu/build/inst/arm-linux-gnueabi/include" #include "..." search starts here: #include <...> search starts here: /usr/local/google/home/mcgrathr/gnu/build/inst/arm-linux-gnueabi/sys-include End of search list. GNU C (GCC) version 4.9.0 20130502 (experimental) (arm-linux-gnueabi) compiled by GNU C version 4.6.3, GMP version 5.0.2, MPFR version 3.1.0-p3, MPC version 0.9 GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 Compiler executable checksum: e560f858071b4c04ef52cbbad3e21d4b