I committed this patch as a test case I worked up for PR 51592. It turns out that Jakub already fixed the problem, but he was only working from a Go test case. This patch adds a C test case in the hopes of making the problem less likely to recur. Committed to mainline.
Ian 2011-12-16 Ian Lance Taylor <i...@google.com> PR middle-end/51592 * gcc.dg/20111216-1.c: New test.
Index: gcc.dg/20111216-1.c =================================================================== --- gcc.dg/20111216-1.c (revision 0) +++ gcc.dg/20111216-1.c (revision 0) @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fexceptions -fnon-call-exceptions" } */ + +extern void f2 () __attribute__ ((noreturn)); +void +f1 () +{ + unsigned char a[8]; + unsigned int i; + + for (i = 0; i < 8; i++) + { + if (i > 8) + f2 (); + a[i] = i <= 8; + } +}