diff options
author | Andrew Pinski <andrew_pinski@playstation.sony.com> | 2007-04-15 00:59:15 +0000 |
---|---|---|
committer | Andrew Pinski <pinskia@gcc.gnu.org> | 2007-04-14 17:59:15 -0700 |
commit | aa24028daf64ebdec03da6094b60c49f0823a16b (patch) | |
tree | 52cf0d33d0e98569dafb400e481d8efe4dec1998 /gcc/c-decl.c | |
parent | f8b8c6d76d48edf5109e5af12d7ca4105534ccb4 (diff) | |
download | gcc-aa24028daf64ebdec03da6094b60c49f0823a16b.zip gcc-aa24028daf64ebdec03da6094b60c49f0823a16b.tar.gz gcc-aa24028daf64ebdec03da6094b60c49f0823a16b.tar.bz2 |
re PR c/31520 (Latent bug in finish_decl causing an errorous "array subscript is above array bounds")
2007-04-14 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR c/31520
* c-del.c (finish_decl): Grab the type of the decl after the call
to store_init_value.
2007-04-14 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR C/31520
* testsuite/gcc.dg/gnu89-init-4.c: New testcase.
From-SVN: r123835
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r-- | gcc/c-decl.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c index eaef0a5..5839fc2 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -3383,7 +3383,7 @@ c_maybe_initialize_eh (void) void finish_decl (tree decl, tree init, tree asmspec_tree) { - tree type = TREE_TYPE (decl); + tree type; int was_incomplete = (DECL_SIZE (decl) == 0); const char *asmspec = 0; @@ -3410,6 +3410,8 @@ finish_decl (tree decl, tree init, tree asmspec_tree) || TREE_CODE (decl) == FIELD_DECL)) objc_check_decl (decl); + type = TREE_TYPE (decl); + /* Deduce size of array from initialization, if not already known. */ if (TREE_CODE (type) == ARRAY_TYPE && TYPE_DOMAIN (type) == 0 |