diff options
author | Andrew Pinski <pinskia@physics.uc.edu> | 2005-11-03 16:15:53 +0000 |
---|---|---|
committer | Andrew Pinski <pinskia@physics.uc.edu> | 2005-11-03 16:15:53 +0000 |
commit | 0921df65ca0b9a8a06dc7d1d005277a23bd17aa8 (patch) | |
tree | 486ee6dc152e01f26744eebbd7a4694f864135df /gcc/gimplify.c | |
parent | 22a14276bc5aae87cbcdd753ec3585db3025babb (diff) |
2005-11-03 Andrew Pinski <pinskia@physics.uc.edu>
PR middle-end/23155
* g++.dg/ext/c99struct1.C: New test.
* gcc.dg/union-cast-1.c: New test.
* gcc.dg/union-cast-2.c: New test.
* gcc.dg/union-cast-3.c: New test.
2005-11-03 Andrew Pinski <pinskia@physics.uc.edu>
PR middle-end/23155
* gimplifier.c (gimplify_expr): Create a temporary for lvalue
CONSTRUCTOR.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@106438 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r-- | gcc/gimplify.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 52e70bdad5e..9e25aef25c2 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -4323,6 +4323,15 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p, *expr_p = temp; ret = GS_OK; } + /* C99 code may assign to an array in a constructed + structure or union, and this has undefined behavior only + on execution, so create a temporary if an lvalue is + required. */ + else if (fallback == fb_lvalue) + { + *expr_p = get_initialized_tmp_var (*expr_p, pre_p, post_p); + lang_hooks.mark_addressable (*expr_p); + } else ret = GS_ALL_DONE; break; |