OSDN Git Service

gcc/
authorsimartin <simartin@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 2 May 2011 20:13:08 +0000 (20:13 +0000)
committersimartin <simartin@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 2 May 2011 20:13:08 +0000 (20:13 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@173269 138bc75d-0d04-0410-961f-82ee72b054a4

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

index faf8eac..da19a8f 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 ce6fd2a..3470a93 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 e6cdd3f..be4f4b6 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" } */