From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4976 invoked by alias); 4 Apr 2003 17:56:03 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 4933 invoked by uid 71); 4 Apr 2003 17:56:01 -0000 Date: Fri, 04 Apr 2003 17:56:00 -0000 Message-ID: <20030404175601.4932.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: "Christian Ehrhardt" Subject: Re: c/9516: [2003-02-01] Internal error when using a big array Reply-To: "Christian Ehrhardt" X-SW-Source: 2003-04/txt/msg00154.txt.bz2 List-Id: The following reply was made to PR c/9516; it has been noted by GNATS. From: "Christian Ehrhardt" 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, }; 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!