https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111454
--- Comment #2 from David Binderman <dcb314 at hotmail dot com> --- (In reply to Andrew Pinski from comment #1) > This is either a dup of bug 111435 or bug 111442 Plausible. I saw the following strange behaviour: $ ~/gcc/results/bin/gcc -c -O1 bug958B.c gcc: internal compiler error: Segmentation fault signal terminated program cc1 Please submit a full bug report, with preprocessed source (by using -freport-bug). See <https://gcc.gnu.org/bugs/> for instructions. $ ~/gcc/results/bin/gcc -c -O2 bug958B.c $ Reduced code is int g_3202, func_1_l_4; int safe_div_func_int16_t_s_s(short si1, short si2) { return si2 || si1 / si2; } short(safe_rshift_func_int16_t_s_s)(); void func_1() __attribute__((optimize("-O2"))); void func_1() { g_3202 = 5; for (; g_3202;) { func_1_l_4 = safe_rshift_func_int16_t_s_s(); break; } safe_div_func_int16_t_s_s(0 != 2, func_1_l_4); }