Bug 42611 - ICE in tree_low_cst, at tree.c:5014
Summary: ICE in tree_low_cst, at tree.c:5014
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: other (show other bugs)
Version: 4.5.0
: P3 normal
Target Milestone: ---
Assignee: Jakub Jelinek
URL:
Keywords:
Depends on: 42146
Blocks:
  Show dependency treegraph
 
Reported: 2010-01-04 15:02 UTC by Debian GCC Maintainers
Modified: 2010-01-05 08:57 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work: 3.4.6
Known to fail: 4.1.2 4.2.4 4.3.4 4.4.3 4.5.0
Last reconfirmed: 2010-01-04 15:20:31


Attachments
preprocessed source (12.97 KB, application/x-gzip)
2010-01-04 15:03 UTC, Debian GCC Maintainers
Details
gcc45-pr42611.patch (648 bytes, patch)
2010-01-04 19:19 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Debian GCC Maintainers 2010-01-04 15:02:57 UTC
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
Comment 1 Debian GCC Maintainers 2010-01-04 15:03:49 UTC
Created attachment 19461 [details]
preprocessed source
Comment 2 Jakub Jelinek 2010-01-04 15:20:31 UTC
Shorter testcase:
struct S { int a; char b[2147483647]; };

void
foo (void)
{
  struct S s;
}
with -m32.
Comment 3 H.J. Lu 2010-01-04 18:10:23 UTC
It is caused by revision 144914:

http://gcc.gnu.org/ml/gcc-cvs/2009-03/msg00421.html
Comment 4 Andrew Pinski 2010-01-04 18:12:00 UTC
I think this is related to (or a dup of bug 42146).
Comment 5 Jakub Jelinek 2010-01-04 18:17:05 UTC
It is not caused by that commit, just add asm volatile ("" : : "r" (&s)) to the testcase and you'll reproduce it even before that.
Comment 6 H.J. Lu 2010-01-04 18:26:10 UTC
Gcc 3.4 gave:

r42611.c: In function `foo':
pr42611.c:6: error: size of variable 's' is too large
Comment 7 Jakub Jelinek 2010-01-04 19:19:49 UTC
Created attachment 19465 [details]
gcc45-pr42611.patch

Untested fix.
Comment 8 Jakub Jelinek 2010-01-05 08:43:04 UTC
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

Comment 9 Jakub Jelinek 2010-01-05 08:56:42 UTC
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

Comment 10 Jakub Jelinek 2010-01-05 08:57:26 UTC
Fixed.