seen on current branches and the trunk, at least on x86 and x86_64: Matthias $ cat x.C #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/types.h> #include <sys/mman.h> #include <sys/stat.h> #include <fcntl.h> #include <memory.h> #include <string.h> #include <limits.h> #include <errno.h> #include <assert.h> #define DEBUG_MODE 1 #define _DEBUG(str,param) { if( DEBUG_MODE == 1 ) { fprintf( stderr, "%s", "[DEBUG] " ); fprintf( stderr, str, param ); } } #ifndef TRUE #define TRUE 1 #endif #ifndef FALSE #define FALSE 0 #endif typedef char bool_t; typedef struct struct_secmem_conf { int pagesize; bool_t crypt; int crypt_key; bool_t to_file; char dumpfile[ SSIZE_MAX ]; } secmem_conf; void init_secmem( secmem_conf* d ) { if( d->pagesize == 0 ) d->pagesize = sysconf( _SC_PAGESIZE ); _DEBUG( "Configuration: pagesize set to: %d\n", d->pagesize ); } int main( int argc, char* argv[] ) { secmem_conf x; return 0; } $ gcc-4.4 -Wall x.C x.C: In function 'int main(int, char**)': x.C:42: warning: unused variable 'x' x.C:41: internal compiler error: in tree_low_cst, at tree.c:5014 Please submit a full bug report, $ /usr/lib/gcc-snapshot/bin/gcc -Wall x.C x.C: In function 'int main(int, char**)': x.C:42:14: warning: unused variable 'x' x.C:41:5: internal compiler error: in tree_low_cst, at tree.c:6178
Created attachment 19461 [details] preprocessed source
Shorter testcase: struct S { int a; char b[2147483647]; }; void foo (void) { struct S s; } with -m32.
It is caused by revision 144914: http://gcc.gnu.org/ml/gcc-cvs/2009-03/msg00421.html
I think this is related to (or a dup of bug 42146).
It is not caused by that commit, just add asm volatile ("" : : "r" (&s)) to the testcase and you'll reproduce it even before that.
Gcc 3.4 gave: r42611.c: In function `foo': pr42611.c:6: error: size of variable 's' is too large
Created attachment 19465 [details] gcc45-pr42611.patch Untested fix.
Subject: Bug 42611 Author: jakub Date: Tue Jan 5 08:42:53 2010 New Revision: 155641 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155641 Log: PR other/42611 * cfgexpand.c (expand_one_var): Diagnose too large variables. * gcc.dg/pr42611.c: New test. Added: trunk/gcc/testsuite/gcc.dg/pr42611.c Modified: trunk/gcc/ChangeLog trunk/gcc/cfgexpand.c trunk/gcc/testsuite/ChangeLog
Subject: Bug 42611 Author: jakub Date: Tue Jan 5 08:56:30 2010 New Revision: 155642 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155642 Log: PR other/42611 * cfgexpand.c (expand_one_var): Diagnose too large variables. * gcc.dg/pr42611.c: New test. Added: branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/pr42611.c Modified: branches/gcc-4_4-branch/gcc/ChangeLog branches/gcc-4_4-branch/gcc/cfgexpand.c branches/gcc-4_4-branch/gcc/testsuite/ChangeLog
Fixed.