diff options
author | Joseph Myers <jsm28@cam.ac.uk> | 2001-12-17 01:18:41 +0000 |
---|---|---|
committer | Joseph Myers <jsm28@gcc.gnu.org> | 2001-12-17 01:18:41 +0000 |
commit | 8d37a5c0db11afb1c4b6d578ad46d1dfb1213118 (patch) | |
tree | b0c444fe54bd3f1b332cc67c0727beaa08189268 /gcc/c-decl.c | |
parent | cf6ede82ac9bf9fdd08be25e806e131ac9a8f47e (diff) | |
download | gcc-8d37a5c0db11afb1c4b6d578ad46d1dfb1213118.zip gcc-8d37a5c0db11afb1c4b6d578ad46d1dfb1213118.tar.gz gcc-8d37a5c0db11afb1c4b6d578ad46d1dfb1213118.tar.bz2 |
re PR c/5105 (compound literal patch broken with inlining)
* c-common.def (COMPOUND_LITERAL_EXPR): Contain a DECL_STMT, not
a DECL directly.
* c-common.h (COMPOUND_LITERAL_EXPR_DECL_STMT): New.
(COMPOUND_LITERAL_EXPR_DECL): Adjust definition.
* c-decl.c (build_compound_literal): Put the decl inside a
DECL_STMT.
* doc/c-tree.texi (COMPOUND_LITERAL_EXPR): Update documentation.
Fixes PR c/5105.
testsuite:
* gcc.c-torture/compile/20011217-1.c: New test.
From-SVN: r48085
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 011624e..c7e1e0a 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -3836,6 +3836,7 @@ build_compound_literal (type, init) the COMPOUND_LITERAL_EXPR rather than added elsewhere as a DECL_STMT. */ tree decl = build_decl (VAR_DECL, NULL_TREE, type); tree complit; + tree stmt; DECL_EXTERNAL (decl) = 0; TREE_PUBLIC (decl) = 0; TREE_STATIC (decl) = (current_binding_level == global_binding_level); @@ -3855,7 +3856,8 @@ build_compound_literal (type, init) if (type == error_mark_node || !COMPLETE_TYPE_P (type)) return error_mark_node; - complit = build1 (COMPOUND_LITERAL_EXPR, TREE_TYPE (decl), decl); + stmt = build_stmt (DECL_STMT, decl); + complit = build1 (COMPOUND_LITERAL_EXPR, TREE_TYPE (decl), stmt); TREE_SIDE_EFFECTS (complit) = 1; layout_decl (decl, 0); |