First Last Prev Next    No search results available      Search page      Enter new bug
Bug#: 7741
Product:  
Component:  
Status: RESOLVED
Resolution: FIXED
Assigned To: Eric Botcazou <ebotcazou@gcc.gnu.org>
Host:
Reported against  
Priority:  
Severity:  
Target Milestone:  
 
 
Target:
Reporter: gnats@kayari.org
Add CC:
CC:
Remove selected CCs
Build:
URL:
Summary:
Keywords:
Known to work:
Known to fail:

Attachment Description Type Created Size Actions
ice1.i.gz ice1.i.gz application/x-gzip 2003-05-21 15:16 3.74 KB Edit
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 7741 depends on: Show dependency tree
Show dependency graph
Bug 7741 blocks:

Additional Comments:






View Bug Activity   |   Format For Printing   |   Clone This Bug


Description:   Last confirmed: Opened: 2002-08-27 14:56
	Compiling the following trivial (but error-ridden) code causes an ICE.

	The code is not valid, and errors are reported, but then ICE!

	Compiling the same code with 2.95 or 3.0 doesn't ICE.

	This is the full output of "gcc3x -v --save-temps ice1.c":

Reading specs from /home/redi/lib/gcc-lib/i586-pc-linux-gnu/3.3/specs
Configured with: ../gcc/configure --prefix=/home/redi --enable-languages=c,c++ --program-suffix=3x --disable-nls --enable-threads=posix
Thread model: posix
gcc version 3.3 20020821 (experimental)
 /home/redi/lib/gcc-lib/i586-pc-linux-gnu/3.3/cc1 -E -quiet -v -D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=0 ice1.c ice1.i
ignoring nonexistent directory "/home/redi/i586-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /home/redi/include
 /home/redi/lib/gcc-lib/i586-pc-linux-gnu/3.3/include
 /usr/include
End of search list.
 /home/redi/lib/gcc-lib/i586-pc-linux-gnu/3.3/cc1 -fpreprocessed ice1.i -quiet -dumpbase ice1.c -auxbase ice1 -version -o ice1.s
GNU C version 3.3 20020821 (experimental) (i586-pc-linux-gnu)
        compiled by GNU C version 3.3 20020821 (experimental).
ice1.c: In function `main':
ice1.c:15: error: conflicting types for `res'
ice1.c:12: error: previous declaration of `res'
ice1.c:12: internal compiler error: Internal compiler error in make_decl_rtl, at varasm.c:811
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.3 20020821 (experimental)

Environment:
System: Linux holyghost.localdomain 2.4.19 #44 Thu Aug 8 23:05:18 BST 2002 i586 unknown
Architecture: i586

	
host: i586-pc-linux-gnu
build: i586-pc-linux-gnu
target: i586-pc-linux-gnu
configured with: ../gcc/configure --prefix=/home/redi --enable-languages=c,c++ --program-suffix=3x --disable-nls --enable-threads=posix

------- Comment #1 From gnats@kayari.org 2002-08-27 14:56 -------
Fix:
	Don't write such bad code   ;-)

------- Comment #2 From gnats@kayari.org 2002-09-08 14:03 -------
From: Jonathan Wakely <gnats@kayari.org>
To: gcc-gnats@gcc.gnu.org, gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org,
   nobody@gcc.gnu.org
Cc:  
Subject: Re: c/7741: ICE on conflicting types
Date: Sun, 8 Sep 2002 14:03:43 +0100

 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7741
 
 The preprocessed source removed the comment I'd made about what caused the
 ICE. Removing the #include <unistd.h> prevents the ICE, and a proper
 diagnostic message is issued about the conflicting type declarations.
 Including unistd.h causes the ICE (so it might be something screwy on my
 system - but it doesn't happen with GCC 3.0)
 
 jon
 

------- Comment #3 From Wolfgang Bangerth 2002-11-27 07:25 -------
State-Changed-From-To: open->feedback
State-Changed-Why: I cannot reproduce this with recent 3.3 CVS. Could you
    please double check whether this still happens?
    
    Thanks
      W.

------- Comment #4 From Wolfgang Bangerth 2002-12-04 13:20 -------
State-Changed-From-To: feedback->analyzed
State-Changed-Why: Thanks for the feedback. Your testcase
    ---------------------------
    int f(int);
    int main()
    {
        char c;        /* any type except int causes ICE */
        int i;
        int c = f(i);
    }
    ------------------------
    indeed ICEs for me. This is a regression on the main trunk,
    so I mark it as that.
    
    Thanks
      Wolfgang

------- Comment #5 From gnats@kayari.org 2002-12-04 20:44 -------
From: Jonathan Wakely <gnats@kayari.org>
To: bangerth@dealii.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org,
   nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: c/7741: ICE on conflicting types
Date: Wed, 4 Dec 2002 20:44:01 +0000

 >     I cannot reproduce this with recent 3.3 CVS. Could you
 >     please double check whether this still happens?
 
 Hmm, it still happens with 20021127 and 20021203 CVS.
 I suspect I've got something wrong with my system.
 
 I've reduced the test case, so it causes an ICE without the #include
 
 int f(int);
 int main()
 {
     char c;        /* any type except int causes ICE */
     int i;
     int c = f(i);
 }
 
 This produces:
 
 $ gcc3x -v ice2.c
 Reading specs from /home/redi/lib/gcc-lib/i586-pc-linux-gnu/3.3/specs
 Configured with: ../gcc/configure --prefix=/home/redi --enable-languages=c,c++ --program-suffix=3x --disable-nls --enable-threads=posix
 Thread model: posix
 gcc version 3.3 20021203 (experimental)
  /home/redi/lib/gcc-lib/i586-pc-linux-gnu/3.3/cc1 -quiet -v -D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=0 ice2.c -quiet -dumpbase ice2.c -auxbase ice2 -version -o /tmp/ccW0MxMe.s
 GNU C version 3.3 20021203 (experimental) (i586-pc-linux-gnu)
 	compiled by GNU C version 3.3 20021203 (experimental).
 ignoring nonexistent directory "/home/redi/i586-pc-linux-gnu/include"
 #include "..." search starts here:
 #include <...> search starts here:
  /usr/local/include
  /home/redi/include
  /home/redi/lib/gcc-lib/i586-pc-linux-gnu/3.3/include
  /usr/include
 End of search list.
 ice2.c: In function `main':
 ice2.c:7: error: conflicting types for `c'
 ice2.c:5: error: previous declaration of `c'
 ice2.c:5: internal compiler error: in make_decl_rtl, at varasm.c:797
 Please submit a full bug report,
 with preprocessed source if appropriate.
 See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
 
 If the two declarations of "c" aren't of the same type, I get an ICE.
 If the declarations are of the same type, it correctly fails to compile,
 without an ICE.
 If I replace the variable "i" with a literal integer, there's no ICE.
 If I make f() take no arguments, there's no ICE.
 
 This was after updating from cvs, deleting my entire build directory,
 configuring and bootstrapping.
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7741

------- Comment #6 From Christian Ehrhardt 2002-12-12 18:06 -------
From: "Christian Ehrhardt" <ehrhardt@mathematik.uni-ulm.de>
To: gcc-gnats@gcc.gnu.org, gcc-patches@gcc.gnu.org, gnats@kayari.org,
  gcc-bugs@gcc.gnu.org, nobody@gcc.gnu.org
Cc:  
Subject: Re: c/7741: [<3.2,3.3> regression] ICE on conflicting types (make_decl_rtl at varasm.c:834)
Date: Thu, 12 Dec 2002 18:06:22 +0100

 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7741
 
 Hi,
 
 this PR is about the following illegal code triggering an ICE, I analyzed why:
 int main() {
 	char c;
 	int i;
 	int c = i;
 }
 
 The problem is in duplicate_decls. When duplicate_decl sees the second
 declaration for c with the initializer it effectivly replaces the
 first declaration with the second leading to the equivilent of this code:
 int main ()
 {
 	int c = i;
 	int i;
 }
 
 with the exception that the now undeclared identifier i in the
 initialization auf c is not detected. This will cause the ICE later on.
 I suggest that we replace unconditionally set DECL_INITIAL to NULL
 in duplicate_decls and possibly print an additional warning if the
 initializer like this:
 
 
 --- gcc-cvs/gcc/gcc/c-decl.c.orig	Thu Dec 12 17:59:13 2002
 +++ gcc-cvs/gcc/gcc/c-decl.c	Thu Dec 12 18:03:34 2002
 @@ -1554,7 +1554,7 @@
      return 0;
  
    /* Copy most of the decl-specific fields of NEWDECL into OLDDECL.
 -     But preserve OLDDECL's DECL_UID.  */
 +     But preserve OLDDECL's DECL_UID and drop the initializer.  */
    {
      unsigned olddecl_uid = DECL_UID (olddecl);
  
 @@ -1562,6 +1562,10 @@
  	    (char *) newdecl + sizeof (struct tree_common),
  	    sizeof (struct tree_decl) - sizeof (struct tree_common));
      DECL_UID (olddecl) = olddecl_uid;
 +    /* This is necessary because the initializer might contain references
 +       to varialbes that were declared between olddecl and newdecl. This
 +       will make the initializer invalid for olddecl. */
 +    DECL_INITIAL (olddecl) = NULL;
    }
  
    /* NEWDECL contains the merged attribute lists.
 
    regards   Christian
 
 -- 
 THAT'S ALL FOLKS!


------- Comment #7 From Christian Ehrhardt 2002-12-21 19:26 -------
From: "Christian Ehrhardt" <ehrhardt@mathematik.uni-ulm.de>
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: c/7741: [3.2/3.3 regression] ICE on conflicting types (make_decl_rtl at varasm.c:834)
Date: Sat, 21 Dec 2002 19:26:15 +0100

 Unfortunately the proposed patch turned out to be bogus on a
 bootstrap test :-( 
 -- 
 THAT'S ALL FOLKS!

------- Comment #8 From Eric Botcazou 2003-02-08 17:30 -------
Responsible-Changed-From-To: unassigned->ebotcazou
Responsible-Changed-Why: Working on a fix.

------- Comment #9 From Eric Botcazou 2003-02-10 12:45 -------
From: ebotcazou@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c/7741
Date: 10 Feb 2003 12:45:54 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	ebotcazou@gcc.gnu.org	2003-02-10 12:45:54
 
 Modified files:
 	gcc            : ChangeLog c-decl.c 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/gcc.dg: decl-2.c 
 
 Log message:
 	PR c/7741
 	* c-decl.c (duplicate_decls): Discard the initializer of the
 	new decl when the types are conflicting.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=1.16680&r2=1.16681
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-decl.c.diff?cvsroot=gcc&r1=1.361&r2=1.362
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2406&r2=1.2407
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/decl-2.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
 


------- Comment #10 From Eric Botcazou 2003-02-10 12:54 -------
From: ebotcazou@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c/7741
Date: 10 Feb 2003 12:54:04 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_3-branch
 Changes by:	ebotcazou@gcc.gnu.org	2003-02-10 12:54:04
 
 Modified files:
 	gcc            : ChangeLog c-decl.c 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/gcc.dg: decl-2.c 
 
 Log message:
 	PR c/7741
 	* c-decl.c (duplicate_decls): Discard the initializer of the
 	new decl when the types are conflicting.
 
 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.169&r2=1.16114.2.170
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-decl.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.356&r2=1.356.2.1
 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.42&r2=1.2261.2.43
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/decl-2.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.2.1
 


------- Comment #11 From Eric Botcazou 2003-02-10 13:01 -------
From: ebotcazou@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c/7741
Date: 10 Feb 2003 13:01:50 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_2-branch
 Changes by:	ebotcazou@gcc.gnu.org	2003-02-10 13:01:50
 
 Modified files:
 	gcc            : ChangeLog c-decl.c 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/gcc.dg: decl-2.c 
 
 Log message:
 	PR c/7741
 	* c-decl.c (duplicate_decls): Discard the initializer of the
 	new decl when the types are conflicting.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.13152.2.657.2.220&r2=1.13152.2.657.2.221
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-decl.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.300.2.10.2.5&r2=1.300.2.10.2.6
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.1672.2.166.2.92&r2=1.1672.2.166.2.93
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/decl-2.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=NONE&r2=1.1.4.1
 

------- Comment #12 From Eric Botcazou 2003-02-10 13:35 -------
State-Changed-From-To: analyzed->closed
State-Changed-Why: Fixed. See http://gcc.gnu.org/ml/gcc-patches/2003-02/msg00641.html

First Last Prev Next    No search results available      Search page      Enter new bug