Created attachment 28498 [details] reduced testcase There are various compiler flags that cause the FAIL. Output: $ gcc -O3 -fPIC testcase.c && ./a.out Aborted $ gcc -O2 -funroll-loops -fPIC testcase.c && ./a.out Aborted $ gcc -O2 -fpeel-loops -fPIC testcase.c && ./a.out Aborted $ gcc -O2 -flto -fPIC testcase.c && ./a.out Aborted Tested revisions: r192641 - fail r191586 - OK 4.7 r191640 - OK
This isn't the only testcase that started failing recently. One interesting flag combination: $ gcc -O2 -fno-tree-ccp -fno-tree-copy-prop -fno-tree-dce testcase.c && ./a.out Segmentation fault In this case, the body of main() isn't generated at all, so the code runs away immediatelly after jumping to main(). main: .LFB2: .cfi_startproc .cfi_endproc .LFE2: .size main, .-main
Started with http://gcc.gnu.org/viewcvs?view=revision&revision=192538
(In reply to comment #2) > Started with http://gcc.gnu.org/viewcvs?view=revision&revision=192538 Thanks for bisecting. The testcase from comment #1 was failing even before that (though instead of segfaulting, the code ended in an endless loop), so it might be a bit different problem.
$ gcc -O2 -funroll-loops -fPIC testcase.c && ./a.out $ gcc -O2 -fpeel-loops -fPIC testcase.c && ./a.out seem to be fine with current trunk. The others are failing though.
In .jump there's ;; Function main (main, funcdef_no=2, decl_uid=1727, cgraph_uid=2) (executed once) Deleted 22 trivially dead insns 3 basic blocks, 1 edges. (note 5 0 4 2 [bb 2] NOTE_INSN_BASIC_BLOCK) (note 4 5 0 2 NOTE_INSN_FUNCTION_BEG) Doesn't look right.
This is similar case as do-1.f90. We have: Statement _6 = m_5 * 2147483647; is executed at most 2 (bounded by 2) + 1 times in loop 1. coming from: while (i--) { g (i * 2147483647); } This overflows for i==4 and leads to undefined effect. So I think the testcase is invalid. Honza
Yeah, the undefined behavior is reached on the testcase unconditionally, so it is definitely invalid.