Using a very very big array in C source will cause gcc to have an internal error. Release: 3.2.2 Environment: Linux debian 2.4.18-bf2.4 i686 GNU/Linux How-To-Repeat: gcc usetab.c
Fix: Using many array instead of a big one :(
State-Changed-From-To: open->analyzed State-Changed-Why: Ugh, really large array... I still get the error with a snapshot from yesterday. W.
From: "Christian Ehrhardt" <ehrhardt@mathematik.uni-ulm.de> To: gcc-gnats@gcc.gnu.org, p.allix@ifrance.com, gcc-bugs@gcc.gnu.org, nobody@gcc.gnu.org, gcc-prs@gcc.gnu.org Cc: Subject: Re: c/9516: [2003-02-01] Internal error when using a big array Date: Fri, 4 Apr 2003 19:48:41 +0200 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9516 Hi, this PR is about a segfault when initializing an array like this: unsigned char tab[] = { 1,2,3,4,<several million initializer element> }; The reason is a stack overflow because the initializer elements are in a TREE_LIST and this list is passed to expr.c:safe_from_p which does an infinite recursion in this piece of code: case 'x': if (TREE_CODE (exp) == TREE_LIST) return ((TREE_VALUE (exp) == 0 || safe_from_p (x, TREE_VALUE (exp), 0)) && (TREE_CHAIN (exp) == 0 || safe_from_p (x, TREE_CHAIN (exp), 0))); I guess that rewriting this as: case 'x': if (TREE_CODE (exp) == TREE_LIST) { tree tmp; for (tmp = exp; tmp; tmp = TREE_CHAIN(tmp)) { if (TREE_VALUE(exp) != 0 && !safe_from_p (x, TREE_VALUE (tmp), 0)) return 0; } return 1; } should fix this PR. I'll bootstrap and regtest. regards Christian -- THAT'S ALL FOLKS!
From: rth@gcc.gnu.org To: gcc-gnats@gcc.gnu.org Cc: Subject: c/9516 Date: 8 Apr 2003 00:22:39 -0000 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_3-branch Changes by: rth@gcc.gnu.org 2003-04-08 00:22:39 Modified files: gcc : ChangeLog expr.c Log message: PR c/9516 * expr.c (safe_from_p): Rearrange to avoid deep recursion in favour of looping and tail recursion for TREE_LIST and binops. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.16114.2.416&r2=1.16114.2.417 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/expr.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.498.2.12&r2=1.498.2.13
From: rth@gcc.gnu.org To: gcc-gnats@gcc.gnu.org Cc: Subject: c/9516 Date: 8 Apr 2003 00:23:17 -0000 CVSROOT: /cvs/gcc Module name: gcc Changes by: rth@gcc.gnu.org 2003-04-08 00:23:17 Modified files: gcc : ChangeLog expr.c Log message: PR c/9516 * expr.c (safe_from_p): Rearrange to avoid deep recursion in favour of looping and tail recursion for TREE_LIST and binops. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=1.17360&r2=1.17361 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/expr.c.diff?cvsroot=gcc&r1=1.517&r2=1.518
State-Changed-From-To: analyzed->closed State-Changed-Why: http://gcc.gnu.org/ml/gcc-patches/2003-04/msg00501.html