From: Simon Martin Date: Mon, 2 May 2011 20:13:08 +0000 (+0000) Subject: re PR c/35445 (ICE with conflicting declarations) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2609a0ce534be7a39dce4dee437eab54503e9b5e;p=gcc.git re PR c/35445 (ICE with conflicting declarations) gcc/ 2011-05-02 Simon Martin PR c/35445 * c-decl.c (finish_decl): Only create a composite if the types are compatible. gcc/testsuite/ 2011-05-02 Simon Martin PR c/35445 * gcc.dg/pr35445.c: New test. From-SVN: r173269 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index faf8eac48f4..da19a8f2b56 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2011-05-02 Simon Martin + + PR c/35445 + * c-decl.c (finish_decl): Only create a composite if the types are + compatible. + 2011-05-02 Joseph Myers * config/fr30/fr30-protos.h (Mmode): Don't define. diff --git a/gcc/c-decl.c b/gcc/c-decl.c index ce6fd2ab364..3470a935d97 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e6cdd3fa654..be4f4b608be 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-05-02 Simon Martin + + PR c/35445 + * gcc.dg/pr35445.c: New test. + 2011-05-02 Jason Merrill * 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 index 00000000000..cef309f41ce --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr35445.c @@ -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" } */