re PR c/13801 (Decls should regain old type at end of scope)
authorJoseph Myers <jsm@polyomino.org.uk>
Thu, 26 Aug 2004 21:30:26 +0000 (22:30 +0100)
committerJoseph Myers <jsm28@gcc.gnu.org>
Thu, 26 Aug 2004 21:30:26 +0000 (22:30 +0100)
commit0b410f0b88b3fc969f85708883e6acb3226827f2
tree73149f504f957d92e288572227263a1e93f7495d
parentdf6e87bf752c78351c8a40c5c824f312e2199621
re PR c/13801 (Decls should regain old type at end of scope)

PR c/13801
* c-decl.c (struct c_binding): Add type and inner_comp fields.
(bind): Set type and inner_comp fields.
(pop_scope): Restore type of decl to the correct type from an
outer scope.  Give error when popping file scope for incomplete
arrays completed incompatibly with default initialization in an
inner scope.
(diagnose_mismatched_decls): Handle externs with initializers at
block scope.
(pushdecl): Set type of external declaration at block scope based
only on the visible declarations.  Save type when changing the
type of a declaration.  Merge an external declaration at block
scope with a visible static declaration at file scope.
(implicitly_declare): Give recycled old declaration the new type
except for incompatible declarations of built-in functions, saving
the old type.

testsuite:
* gcc.dg/redecl-3.c, gcc.dg/redecl-4.c, gcc.dg/redecl-6.c,
gcc.dg/redecl-7.c, gcc.dg/redecl-8.c, gcc.dg/redecl-9.c,
gcc.dg/redecl-10.c, gcc.dg/debug/redecl-1.c,
gcc.dg/debug/redecl-2.c, gcc.dg/debug/redecl-3.c,
gcc.dg/debug/redecl-4.c, gcc.dg/debug/redecl-5.c: New tests.

From-SVN: r86636
15 files changed:
gcc/ChangeLog
gcc/c-decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/debug/redecl-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/debug/redecl-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/debug/redecl-3.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/debug/redecl-4.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/debug/redecl-5.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/redecl-10.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/redecl-3.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/redecl-4.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/redecl-6.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/redecl-7.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/redecl-8.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/redecl-9.c [new file with mode: 0644]