aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-decl.c
diff options
context:
space:
mode:
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>2004-04-12 21:25:55 +0000
committerRichard Kenner <kenner@gcc.gnu.org>2004-04-12 17:25:55 -0400
commit1c9766da11d71cb57f8962a2eb88833c1ca966f5 (patch)
treefc6c6b14412060a9d6d90d3f45c768a4648b7f4b /gcc/c-decl.c
parent040e098a5de9115501bd76ce0ea7adc9a0eded21 (diff)
downloadgcc-1c9766da11d71cb57f8962a2eb88833c1ca966f5.zip
gcc-1c9766da11d71cb57f8962a2eb88833c1ca966f5.tar.gz
gcc-1c9766da11d71cb57f8962a2eb88833c1ca966f5.tar.bz2
c-decl.c (finish_decl): Make a decl_stmt for a variable-sized TYPE_DECL.
* c-decl.c (finish_decl): Make a decl_stmt for a variable-sized TYPE_DECL. * c-semantics.c (genrtl_decl_stmt): Handle TYPE_DECL. * stmt.c (expand_decl): Remove redundant expansion of TYPE_DOMAIN. * stor-layout.c (variable_size): Don't check for MINUS_EXPR. Use skip_simple_arithmetic to find SAVE_EXPR. (force_type_save_exprs, force_type_save_exprs_1): New functions. * tree-inline.c (remap_type, case POINTER_TYPE, case REFERENCE_TYPE): Properly chain multiple pointers. (copy_tree_r): Copy a TYPE_DECL. * tree.c (variably_modified_type_p): Add some missing tests and make some other minor changes. * tree.h (force_type_save_exprs): New declaration. * gcc.c-torture/execute/20040411-1.c: New test. From-SVN: r80629
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r--gcc/c-decl.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index de96be3..8f19647 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -2979,7 +2979,13 @@ finish_decl (tree decl, tree init, tree asmspec_tree)
mark_referenced (DECL_ASSEMBLER_NAME (decl));
if (TREE_CODE (decl) == TYPE_DECL)
- rest_of_decl_compilation (decl, NULL, DECL_FILE_SCOPE_P (decl), 0);
+ {
+ if (!DECL_FILE_SCOPE_P (decl)
+ && variably_modified_type_p (TREE_TYPE (decl)))
+ add_decl_stmt (decl);
+
+ rest_of_decl_compilation (decl, NULL, DECL_FILE_SCOPE_P (decl), 0);
+ }
/* At the end of a declaration, throw away any variable type sizes
of types defined inside that declaration. There is no use