Created attachment 1133484 [details] preprocessed source file cfitsio test case segfaults when built with -O2, but runs correctly with -O1 or -mno-lra (Jakub, thanks for the hint :-)) gcc -o testprog -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 testprog.i -L. -lcfitsio -lz -lm -lpthread from GDB ... Program received signal SIGSEGV, Segmentation fault. main () at testprog.c:2209 2209 printf(" %2.0f", doutarray[jj]); Missing separate debuginfos, use: dnf debuginfo-install zlib-1.2.8-10.fc24.s390x (gdb) where #0 main () at testprog.c:2209 (gdb) l 2204 printf(" %2.0f", eoutarray[jj]); 2205 printf(" %d\nD", status); 2206 2207 ffgcvd(fptr, 8, ii, 1, ii, 99., doutarray, &anynull, &status); 2208 for (jj = 0; jj < ii; jj++) 2209 printf(" %2.0f", doutarray[jj]); 2210 printf(" %d\n", status); 2211 2212 ffgdes(fptr, 8, ii, &repeat, &offset, &status); 2213 printf("Column 8 repeat and offset = %ld %ld\n", repeat, offset); (gdb) koji build is http://s390.koji.fedoraproject.org/koji/taskinfo?taskID=2139659 more info will follow Version-Release number of selected component (if applicable): gcc-6.0.0-0.14.fc24.s390x but I got the segfault also from -15
Started with http://gcc.gnu.org/r222144 Unfortunately the problem is in a huge function, and while I've managed to remove a few statements from it already while still reproducing the problem, it still calls 184 different functions from the library.
yes, that's what I've figured out too, 80k of text in main() :-(
build/test suite passes with gcc-6.0.0-0.18.fc24