]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c/7741 (ICE on conflicting types (make_decl_rtl at varasm.c:834))
authorEric Botcazou <ebotcazou@libertysurf.fr>
Mon, 10 Feb 2003 13:01:50 +0000 (14:01 +0100)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Mon, 10 Feb 2003 13:01:50 +0000 (13:01 +0000)
PR c/7741
* c-decl.c (duplicate_decls): Discard the initializer of the
new decl when the types are conflicting.

Co-Authored-By: Christian Ehrhardt <ehrhardt@mathematik.uni-ulm.de>
From-SVN: r62636

gcc/ChangeLog
gcc/c-decl.c
gcc/testsuite/ChangeLog

index 4d56e63e0c9d0da9d9720166b48533cbdd1d2104..ece8df5528e5a4996563c756be565ed812b8d00f 100644 (file)
@@ -1,3 +1,10 @@
+2003-02-10  Eric Botcazou  <ebotcazou@libertysurf.fr>
+            Christian Ehrhardt  <ehrhardt@mathematik.uni-ulm.de>
+
+       PR c/7741
+       * c-decl.c (duplicate_decls): Discard the initializer of the
+       new decl when the types are conflicting.
+
 2003-02-01  Daniel Jacobowitz  <drow@mvista.com>
 
        * dwarf2out.c (gen_type_die): Check for typedefs before calling
index 2c8857fc4964f596a6f856b0349cf869a3bcc946..ea02f2665569ef5f5427538d3f96bef7ccc4a1b1 100644 (file)
@@ -1665,6 +1665,12 @@ duplicate_decls (newdecl, olddecl, different_binding_level)
            }
        }
       error_with_decl (olddecl, "previous declaration of `%s'");
+
+      /* This is safer because the initializer might contain references
+        to variables that were declared between olddecl and newdecl. This
+        will make the initializer invalid for olddecl in case it gets
+        assigned to olddecl below.  */
+      DECL_INITIAL (newdecl) = 0;
     }
   else
     {
index 77abd73f44f219067fb92b038951cbbcf7ba7515..3ad51e68dede46ad52f55c876a9ae14d23c1b461 100644 (file)
@@ -1,3 +1,8 @@
+2003-02-10  Eric Botcazou  <ebotcazou@libertysurf.fr>
+            Christian Ehrhardt  <ehrhardt@mathematik.uni-ulm.de>
+
+       * gcc.dg/decl-2.c: New test.
+
 2003-02-06  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * gcc.dg/20020430-1.c: Fix dg command typos.