http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50287
Bug #: 50287 Summary: FAIL: gcc.c-torture/execute/builtins/vsnprintf-chk.c compilation, -O2 -flto Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Keywords: ice-on-valid-code Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassig...@gcc.gnu.org ReportedBy: kkoj...@gcc.gnu.org Target: arm-eabi sh*-*-* Several gcc.c-torture/execute/builtins/*-chk.c tests fail for ARM and SH with -O2 -flto: gcc/testsuite/gcc.c-torture/execute/builtins/lib/chk.c: In function '__vsnprintf_chk': gcc/testsuite/gcc.c-torture/execute/builtins/lib/chk.c:398:1: error: number of operands and imm-links don't agree in statement # .MEM_57 = VDEF <.MEM_22> ap = ap_18(D); gcc/testsuite/gcc.c-torture/execute/builtins/lib/chk.c:398:1: internal compiler error: verify_ssa failed A reduced testcase for arm-eabi: static char buf[4096]; int __attribute__((format(printf,4,0))) foo (char *str, unsigned int len, unsigned int size, const char *fmt, __builtin_va_list ap); int foo (char *str, unsigned int len, unsigned int size, const char *fmt, __builtin_va_list ap) { if (!size) return 0; if (size < len) bar (str, buf, size + 1); else bar (str, buf, len - 1); return 0; } It has started to fail after revision 178386. It seems that the fix for PR49886 reveals this issue. -fno-partial-inlining makes the ICE go away.