There are 3 possible problems: 1) bootstrap with BOOT_CFLAGS="-O2 -fstack-protector" fails when compiling i386.o 2) warning in testcase.c 3) warning about x.0 in testcase2.c, crashing output binary
I don't know if any of these problems is a real bug. All testcases were tested with recent builds of gcc trunk and 4.4 branch. ad 1) Bootstrap fails with BOOT_CFLAGS="-O2 -fstack-protector" $ gcc-4.4.3 -fstack-check -Wuninitialized -Wno-format -Werror -O2 i386.i -c cc1: warnings being treated as errors /mnt/svn/gcc-trunk/gcc/config/i386/i386.c: In function ‘ix86_expand_vector_init_duplicate’: /mnt/svn/gcc-trunk/gcc/config/i386/i386.c:26684: error: ‘dperm.4211’ may be used uninitialized in this function /mnt/svn/gcc-trunk/gcc/config/i386/i386.c:26706: error: ‘saved_stack.4216’ may be used uninitialized in this function ad 2) This file, testcase.c, was reduced from gcc/config/i386/i386.c ---------- testcase.c ---------- void foo(void) { goto lab; { int x[64]; lab:; } } -------------------------------- $ gcc-4.4.3 -Wuninitialized -c testcase.c $ gcc-4.4.3 -fstack-check -Wuninitialized -c testcase.c testcase.c: In function ‘foo’: testcase.c:7: warning: ‘saved_stack.1’ is used uninitialized in this function (behaviour is the same with -O1, -O2, -O3) ad 3) Second testcase crashes when compiled with -fstack-protector: ---------- testcase2.c ---------- __attribute__((noinline)) int foo(void) { goto lab; { int x[64]; lab:; x[63] = 0; return x[63]; } } int main() { return foo(); } -------------------------------- $ gcc-4.4.3 -Wuninitialized testcase2.c && ./a.out $ gcc-4.4.3 -fstack-check -Wuninitialized testcase2.c && ./a.out testcase2.c: In function ‘foo’: testcase2.c:7: warning: ‘x.0’ is used uninitialized in this function testcase2.c:9: warning: ‘saved_stack.1’ is used uninitialized in this function Segmentation fault (SIGSEGV) (behaviour is the same with -O1, -O2, -O3) -- Summary: "warning: 'saved_stack.1' is used uninitialized in this function" with -fstack-protector Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: zsojka at seznam dot cz GCC host triplet: x86_64-pc-linux-gnu GCC target triplet: x86_64-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43013