re PR c/35445 (ICE with conflicting declarations)
authorSimon Martin <simartin@users.sourceforge.net>
Mon, 2 May 2011 20:13:08 +0000 (20:13 +0000)
committerSimon Martin <simartin@gcc.gnu.org>
Mon, 2 May 2011 20:13:08 +0000 (20:13 +0000)
gcc/

2011-05-02  Simon Martin  <simartin@users.sourceforge.net>

    PR c/35445
    * c-decl.c (finish_decl): Only create a composite if the types are
    compatible.

gcc/testsuite/

2011-05-02  Simon Martin  <simartin@users.sourceforge.net>

    PR c/35445
    * gcc.dg/pr35445.c: New test.

From-SVN: r173269

gcc/ChangeLog
gcc/c-decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr35445.c [new file with mode: 0644]

index faf8eac48f41a788635c78b156088c224bf1b55a..da19a8f2b564449a36735a28c047e30c198d08d5 100644 (file)
@@ -1,3 +1,9 @@
+2011-05-02  Simon Martin  <simartin@users.sourceforge.net>
+
+       PR c/35445
+       * c-decl.c (finish_decl): Only create a composite if the types are
+       compatible.
+
 2011-05-02  Joseph Myers  <joseph@codesourcery.com>
 
        * config/fr30/fr30-protos.h (Mmode): Don't define.
index ce6fd2ab364f382ba025779fe7d3a75a061afa63..3470a935d977fa92fbf737fed13fc538502b9dc3 100644 (file)
@@ -4246,7 +4246,7 @@ finish_decl (tree decl, location_t init_loc, tree init,
                b_ext = b_ext->shadowed;
              if (b_ext)
                {
-                 if (b_ext->u.type)
+                 if (b_ext->u.type && comptypes (b_ext->u.type, type))
                    b_ext->u.type = composite_type (b_ext->u.type, type);
                  else
                    b_ext->u.type = type;
index e6cdd3fa654a3359013334791eb7ca68e3bcacb0..be4f4b608be92d72b2e1025b6c1699a4fc37c115 100644 (file)
@@ -1,3 +1,8 @@
+2011-05-02  Simon Martin  <simartin@users.sourceforge.net>
+
+       PR c/35445
+       * gcc.dg/pr35445.c: New test.
+
 2011-05-02  Jason Merrill  <jason@redhat.com>
 
        * c-c++-common/vla-1.c: New.
diff --git a/gcc/testsuite/gcc.dg/pr35445.c b/gcc/testsuite/gcc.dg/pr35445.c
new file mode 100644 (file)
index 0000000..cef309f
--- /dev/null
@@ -0,0 +1,6 @@
+/* PR c/35445 */
+/* { dg-do "compile" } */
+
+extern int i;
+extern int i; /* { dg-message "was here" } */
+int i[] = { 0 }; /* { dg-error "conflicting types" } */