diff options
author | aldyh <aldyh@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-12-12 11:12:39 +0000 |
---|---|---|
committer | aldyh <aldyh@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-12-12 11:12:39 +0000 |
commit | 82972775f53524f04053da5a13027a7649437d2f (patch) | |
tree | 152c25d48afd460f70909cee7507677f1f8c0bfa /gcc/gimplify.c | |
parent | 29847ec4952258319a397b4a567dc31f942aac5c (diff) | |
download | gcc-82972775f53524f04053da5a13027a7649437d2f.tar.gz |
* gimplify.c (gimplify_modify_expr_rhs): Handle the case when we
are assigning from a constant constructor.
Fix wrapping in function comment.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@130788 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r-- | gcc/gimplify.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 06f73802a88..54d5c46ec3e 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -3470,8 +3470,9 @@ fold_indirect_ref_rhs (tree t) return NULL_TREE; } -/* Subroutine of gimplify_modify_expr to do simplifications of MODIFY_EXPRs - based on the code of the RHS. We loop for as long as something changes. */ +/* Subroutine of gimplify_modify_expr to do simplifications of + MODIFY_EXPRs based on the code of the RHS. We loop for as long as + something changes. */ static enum gimplify_status gimplify_modify_expr_rhs (tree *expr_p, tree *from_p, tree *to_p, tree *pre_p, @@ -3482,6 +3483,18 @@ gimplify_modify_expr_rhs (tree *expr_p, tree *from_p, tree *to_p, tree *pre_p, while (ret != GS_UNHANDLED) switch (TREE_CODE (*from_p)) { + case VAR_DECL: + /* If we're assigning from a constant constructor, move the + constructor expression to the RHS of the MODIFY_EXPR. */ + if (DECL_INITIAL (*from_p) + && TYPE_READONLY (TREE_TYPE (*from_p)) + && TREE_CODE (DECL_INITIAL (*from_p)) == CONSTRUCTOR) + { + *from_p = DECL_INITIAL (*from_p); + ret = GS_OK; + } + ret = GS_UNHANDLED; + break; case INDIRECT_REF: { /* If we have code like |