http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50397
Bug #: 50397 Summary: openssl crash due to incorrect codegen when using LTO Classification: Unclassified Product: gcc Version: 4.6.2 Status: UNCONFIRMED Severity: major Priority: P3 Component: middle-end AssignedTo: unassig...@gcc.gnu.org ReportedBy: m...@use.net When adding -flto and compiling openssl-1.0.0d with gcc-4.6.real (Ubuntu/Linaro 4.6.1-9ubuntu2) that comes with Ubuntu 11.10, the testsuite fails with a segfault during the bignumber tests. To reproduce: 1. untar openssl-1.0.0d 2. make this change in the Configure file on the "debian-amd64" line: "debian-amd64", "gcc:-m64 -DL_ENDIAN -DTERMIO -O2 -flto -floop-block -floop-flatten -floop-interchange -floop-strip-mine -Wa,--noexecstack -g -Wall -DMD32_REG_T=int::-D_REENTRANT::-Wl,-flto=2 -ldl -Wl,-Bsymbolic-functions:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::", 3. make, which will run the tests and fail. 4. for extra grins, run the specific suite under valgrind: matt@matt-desktop:~/openssl-1.0.0d/test$ valgrind -q --trace-children=yes ../util/shlib_wrap.sh ./bntest [...] ==12136== Process terminating with default action of signal 8 (SIGFPE) ==12136== Integer divide by zero at address 0x40359EA94 ==12136== at 0x433C4D: BN_div (bn_div.c:342) ==12136== by 0x403B86: main (bntest.c:1951) Floating point exception (core dumped) PS: I filed this as 4.6.2, given the number of patches that Linaro has applied to this 4.6.1 base version. If that's wrong, let me know. I tried testing it on trunk, but that gets an ICE during compile (filing a separate bug).