Bug 7675 - [3.2/3.3/3.4 regression] ICE in fixup_var_refs_1
Summary: [3.2/3.3/3.4 regression] ICE in fixup_var_refs_1
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 3.2.1
: P3 normal
Target Milestone: ---
Assignee: Eric Botcazou
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2002-08-21 03:06 UTC by sowhat
Modified: 2004-01-17 04:22 UTC (History)
5 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
sdbmfldu.i (51.84 KB, text/x-c)
2003-05-21 15:17 UTC, sowhat
Details

Note You need to log in before you can comment on or make changes to this bug.
Description sowhat 2002-08-21 03:06:01 UTC
Reading specs from /usr/local/snap/gcc-20020819/lib/gcc-lib/i686-pc-linux-gnu/3.2.1/specs
Configured with: ./configure --enable-languages=c,c++,objc --disable-shared --enable-threads --without-cvs --prefix=/usr/local/snap/gcc-20020819 i686-pc-linux-gnu
Thread model: posix
gcc version 3.2.1 20020819 (prerelease)
 /usr/local/snap/gcc-20020819/lib/gcc-lib/i686-pc-linux-gnu/3.2.1/cpp0 -lang-c -v -I. -I. -I../../src/sdbm.v0 -iprefix /usr/local/bin/../lib/gcc-lib/i686-pc-linux-gnu/3.2.1/ -D__GNUC__=3 -D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=1 -D__GXX_ABI_VERSION=102 -D__ELF__ -Dunix -D__gnu_linux__ -Dlinux -D__ELF__ -D__unix__ -D__gnu_linux__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__OPTIMIZE__ -D__STDC_HOSTED__=1 -dD -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__i586 -D__i586__ -D__pentium -D__pentium__ -D__tune_i586__ -D__tune_pentium__ -DAXIS_LIBOBJ -DcCompo=cCompoSdbmV0 ../../src/sdbm.v0/sdbmfldu.c -Wall -Wcast-align -Wno-format -Werror sdbmfldu.i
GNU CPP version 3.2.1 20020819 (prerelease) (cpplib) (i386 Linux/ELF)
ignoring nonexistent directory "/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.2.1/include"
ignoring nonexistent directory "/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.2.1/../../../../i686-pc-linux-gnu/include"
ignoring nonexistent directory "/usr/local/snap/gcc-20020819/i686-pc-linux-gnu/include"
ignoring duplicate directory "."
#include "..." search starts here:
#include <...> search starts here:
 .
 ../../src/sdbm.v0
 /usr/local/include
 /usr/local/snap/gcc-20020819/include
 /usr/local/snap/gcc-20020819/lib/gcc-lib/i686-pc-linux-gnu/3.2.1/include
 /usr/include
End of search list.
 /usr/local/snap/gcc-20020819/lib/gcc-lib/i686-pc-linux-gnu/3.2.1/cc1 -fpreprocessed sdbmfldu.i -quiet -dumpbase sdbmfldu.c -mcpu=pentium -march=pentium -malign-double -g3 -O2 -Wall -Wcast-align -Wno-format -Werror -version -fexceptions -o sdbmfldu.s
GNU CPP version 3.2.1 20020819 (prerelease) (cpplib) (i386 Linux/ELF)
GNU C version 3.2.1 20020819 (prerelease) (i686-pc-linux-gnu)
        compiled by GNU C version 2.95.4 20011002 (Debian prerelease).
../../src/sdbm.v0/sdbmfldu.c: In function `SdbmListData':
../../src/sdbm.v0/sdbmfldu.c:1590: Internal compiler error in fixup_var_refs_1, at function.c:1964
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.

Release:
3.2.1 20020819 (prerelease)

Environment:
Configured with: ./configure --enable-languages=c,c++,objc --disable-shared --enable-threads --without-cvs --prefix=/usr/local/snap/gcc-20020819 i686-pc-linux-gnu
Thread model: posix
gcc version 3.2.1 20020819 (prerelease)

How-To-Repeat:
It reappears only in this specific source file. 
It does not reappear in GCC-2.95. 
It reappears in any GCC-3.x(3.0.0/3.1/3.1.1/3.2)
Comment 1 s.bosscher 2002-09-19 00:32:47 UTC
From: Steven Bosscher <s.bosscher@student.tudelft.nl>
To: gcc-gnats@gcc.gnu.org, gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org
Cc:  
Subject: Re: middle-end/7675: Internal compiler error in fixup_var_refs_1
Date: Thu, 19 Sep 2002 00:32:47 +0200

 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7675
 
 This looks like a duplicate of both PR 7370 and PR 7324.
 
 Kill this one and you can close three bugs :-)
 
Comment 2 Volker Reichelt 2002-11-29 14:18:13 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed.
    The bug is still present in gcc 3.2.1 and mainline.
Comment 3 Volker Reichelt 2002-11-30 01:00:32 UTC
From: Volker Reichelt <reichelt@igpm.rwth-aachen.de>
To: gcc-gnats@gcc.gnu.org, gcc-bugs@gcc.gnu.org, nobody@gcc.gnu.org,
        sowhat@amnis.co.jp
Cc:  
Subject: Re: optimization/7675: [3.2/3.3 regression] ICE in fixup_var_refs_1
Date: Sat, 30 Nov 2002 01:00:32 +0100

 Here's a reduced testcase (crashes on i686-pc-linux-gnu and
 mips-sgi-irix6.5 since gcc 3.0). Just compile with "gcc -O -c".
 
 ---------------------snip here---------------------
 void foo(int i, int j)
 {
     int k=j;
 
     void bar() { int x=k, y=i, z=j; }
 
     dummy(&j);
 }
 ---------------------snip here---------------------
 
 BTW, the bug is unrelated to PR 7370 and PR 7324 - those are already
 fixed.
 
 Regards,
 Volker
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7675
 
 
Comment 4 Eric Botcazou 2002-12-03 06:06:24 UTC
Responsible-Changed-From-To: unassigned->ebotcazou
Responsible-Changed-Why: Working on a fix.
Comment 5 janis187 2002-12-24 12:24:53 UTC
From: Janis Johnson <janis187@us.ibm.com>
To: gcc-gnats@gcc.gnu.org, gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org,
   sowhat@amnis.co.jp, ebotcazou@gcc.gnu.org
Cc:  
Subject: Re: optimization/7675: [3.2/3.3 regression] ICE in fixup_var_refs_1
Date: Tue, 24 Dec 2002 12:24:53 -0800

 The regression reported in PR optimization/7675 showed up
 starting with this patch:
 
 2000-11-11  Jason Merrill  <jason@redhat.com>
 
         * function.c (assign_parms): If TREE_ADDRESSABLE is set, try to
         give the parm a register and then call put_var_into_stack.
         * stmt.c (expand_decl): Likewise.
 
 cp/
         * typeck.c (mark_addressable): Don't call put_var_into_stack.
 
 Here's a small test case that causes the compiler to ICE
 when compiled on i686-linux with -O:
 
 -------------------
 /* ICE when compiled with -O */
 
 int dummy (int *);
 
 void foo(int i, int j)
 {
   int k=j;
 
   void bar() { int x=k, y=i, z=j; }
 
   dummy(&j);
 }
 -------------------
 
 Output from the mainline compiler:
 
 7675.c: In function `foo':
 7675.c:9: internal compiler error: in fixup_var_refs_1, at
 function.c:1900
 Please submit a full bug report,
 with preprocessed source if appropriate.
 See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
 
 Eric, I just noticed that you're working on a patch.  Perhaps
 this information will be useful for you.
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7675
 
 
 

Comment 6 Eric Botcazou 2002-12-31 09:19:06 UTC
From: "Eric Botcazou" <ebotcazou@libertysurf.fr>
To: <janis187@us.ibm.com>
Cc: <gcc-gnats@gcc.gnu.org>,
	<gcc-prs@gcc.gnu.org>,
	<gcc-bugs@gcc.gnu.org>,
	<sowhat@amnis.co.jp>
Subject: Re: optimization/7675: [3.2/3.3 regression] ICE in fixup_var_refs_1
Date: Tue, 31 Dec 2002 09:19:06 +0100

 > Eric, I just noticed that you're working on a patch.  Perhaps
 > this information will be useful for you.
 
 See the analysis and the patch at:
 http://gcc.gnu.org/ml/gcc-patches/2002-12/msg00336.html
 
 Unfortunately, the bug is the consequence of a fundamental problem with
 nested functions in the C front-end, whose right solution is the one
 proposed by Richard:
 http://gcc.gnu.org/ml/gcc-patches/2002-12/msg00367.html
 
 I'll try to address it for 3.4 and, in the meantime, ask Richard what to do
 for the 3.2 and 3.3 branches, in light of you pinpointing Jason's patch.
 
 Thanks.
 
 - Eric
 
 

Comment 7 Eric Botcazou 2003-04-18 06:45:15 UTC
From: ebotcazou@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: optimization/7675
Date: 18 Apr 2003 06:45:15 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	ebotcazou@gcc.gnu.org	2003-04-18 06:45:15
 
 Modified files:
 	gcc            : ChangeLog c-typeck.c stmt.c 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/gcc.c-torture/compile: 20030418-1.c 
 
 Log message:
 	PR optimization/7675
 	* c-typeck.c (build_external_ref): Set the DECL_NONLOCAL flag
 	on VAR_DECL, PARM_DECL and FUNCTION_DECL from within
 	nested functions if they refer to declarations from parent functions.
 	* stmt.c (expand_decl): Don't put automatic variables in registers
 	if the DECL_NONLOCAL flag is set.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=1.17507&r2=1.17508
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-typeck.c.diff?cvsroot=gcc&r1=1.232&r2=1.233
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/stmt.c.diff?cvsroot=gcc&r1=1.297&r2=1.298
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2602&r2=1.2603
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/compile/20030418-1.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
 

Comment 8 Eric Botcazou 2003-04-18 06:50:50 UTC
From: ebotcazou@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: optimization/7675
Date: 18 Apr 2003 06:50:50 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_3-branch
 Changes by:	ebotcazou@gcc.gnu.org	2003-04-18 06:50:50
 
 Modified files:
 	gcc            : ChangeLog c-typeck.c stmt.c 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/gcc.c-torture/compile: 20030418-1.c 
 
 Log message:
 	PR optimization/7675
 	* c-typeck.c (build_external_ref): Set the DECL_NONLOCAL flag
 	on VAR_DECL, PARM_DECL and FUNCTION_DECL from within
 	nested functions if they refer to declarations from parent functions.
 	* stmt.c (expand_decl): Don't put automatic variables in registers
 	if the DECL_NONLOCAL flag is set.
 
 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.454&r2=1.16114.2.455
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-typeck.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.213.2.5&r2=1.213.2.6
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/stmt.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.276.2.8&r2=1.276.2.9
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.2261.2.141&r2=1.2261.2.142
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/compile/20030418-1.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.2.1
 
Comment 9 Eric Botcazou 2003-04-18 06:59:11 UTC
State-Changed-From-To: analyzed->closed
State-Changed-Why: Fixed on 3.3 branch and mainline.
    See http://gcc.gnu.org/ml/gcc-patches/2003-04/msg01205.html