http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46534
Summary: [4.3/4.4/4.5/4.6 Regression] ICE optimizing printf
("...>10MBstring\n") into puts
Product: gcc
Version: 4.4.5
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
AssignedTo: [email protected]
ReportedBy: [email protected]
/* { dg-do compile } */
/* { dg-options "-O2" } */
#define S1 " "
#define S2 S1 S1 S1 S1 S1 S1 S1 S1 S1 S1
#define S3 S2 S2 S2 S2 S2 S2 S2 S2 S2 S2
#define S4 S3 S3 S3 S3 S3 S3 S3 S3 S3 S3
#define S5 S4 S4 S4 S4 S4 S4 S4 S4 S4 S4
#define S6 S5 S5 S5 S5 S5 S5 S5 S5 S5 S5
#define S7 S6 S6 S6 S6 S6 S6 S6 S6 S6 S6
void
foo (void)
{
__builtin_printf (S7 "\n");
}
ICEs, because printf->puts folding uses XALLOCAVEC for the string literal,
which for very long strings overflows the stack.