Compiling void foo () { float c[204800000][4]; } fails with t3.c: In function 'foo': t3.c:16: internal compiler error: in tree_low_cst, at tree.c:3846 All current CVS versions (4.X fail). At least some 3.x versions are not affected GCC 2.96 shows an other error. Affected Versions, which I tested: 4.1.0 20050416 4.1.0 20050302 2.96 20000731 (Red Hat Linux 7.2 2.96-112.7.2) Non Affected Version: 3.3.3 20040412 (Red Hat Linux 3.3.3-7)
Confirmed, this is most likely caused by the tree-ssa merge.
Patch here: <http://gcc.gnu.org/ml/gcc-patches/2005-05/msg00121.html>.
Hmm, Jim posted a patch here: <http://gcc.gnu.org/ml/gcc-patches/2005-05/msg00377.html> but never applied it.
Subject: Re: [4.0/4.1 Regression] Compiling of large array fails pinskia at gcc dot gnu dot org wrote: > ------- Additional Comments From pinskia at gcc dot gnu dot org 2005-07-25 15:50 ------- > Hmm, Jim posted a patch here: <http://gcc.gnu.org/ml/gcc-patches/2005-05/msg00377.html> but > never applied it. I never finished my patch. I was hoping someone else would help finish it. Since it is my patch, I'll follow up on this. The first thing I did here is grep the entire tree for TREE_OVERFLOW (TYPE_SIZE (...)) since all such occurances are broken. I found 3. One in the C front end (this bug), one in the C++ front end, and one in the Ada front end. I can't create a testcase for the Ada bug, nor can I at the moment build the Ada front end, so there is not much I can do there other than maybe create a new bug report for it and insert the obvious patch. The C++ code is identical to the C code, so the same testcase and patch work here. Unfortunately, there is a problem. I get tmp.cc:13: error: size of array ‘array’ is too large tmp.cc:17: error: ‘array’ was not declared in this scope The first error is correct, the second one isn't. Or at least I assume it isn't. I'm not qualified to comment on that, nor am I qualified to fix it. So, um, I guess I am creating yet another new bug report for that. For the C front end, I have a patch that I believe is correct, and I have a small testcase that I think is reasonably portable. I need to drop my testcase into the testsuite with dg annotations, and test it all with a bootstrap and make check.
Subject: Bug 21105 CVSROOT: /cvs/gcc Module name: gcc Changes by: wilson@gcc.gnu.org 2005-08-16 18:23:59 Modified files: gcc : ChangeLog c-decl.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/gcc.dg: large-size-array.c Log message: Emit an error for too large arrays instead of an ICE. PR tree-optimization/21105 * c-decl.c (grokdeclarator): Use TYPE_SIZE_UNIT not TYPE_SIZE in TREE_OVERFLOW check. * gcc.dg/large-size-array.c: New. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.9745&r2=2.9746 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-decl.c.diff?cvsroot=gcc&r1=1.680&r2=1.681 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5928&r2=1.5929 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/large-size-array.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
Subject: Bug 21105 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-4_0-branch Changes by: wilson@gcc.gnu.org 2005-08-16 20:34:21 Modified files: gcc : ChangeLog c-decl.c Log message: Fix ICE that occurs with too large array. PR tree-optimization/21105 * c-decl.c (grokdeclarator): Use TYPE_SIZE_UNIT not TYPE_SIZE in TREE_OVERFLOW check. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=2.7592.2.371&r2=2.7592.2.372 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-decl.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.630.6.15&r2=1.630.6.16
The C front end bug is fixed on mainline and the gcc-4.0.x branch. The C++ and Ada front end bugs have their own PRs now.
Subject: Bug 21105 CVSROOT: /cvs/gcc Module name: gcc Changes by: wilson@gcc.gnu.org 2005-08-22 23:52:24 Modified files: gcc/cp : ChangeLog decl.c Log message: Partial fix for too large arrays. PR tree-optimization/21105 * decl.c (grokdeclarator): Use TYPE_SIZE_UNIT not TYPE_SIZE for array size check. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4854&r2=1.4855 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&r1=1.1419&r2=1.1420