diff options
author | Olivier Hainque <hainque@adacore.com> | 2006-08-21 16:01:03 +0000 |
---|---|---|
committer | Olivier Hainque <hainque@gcc.gnu.org> | 2006-08-21 16:01:03 +0000 |
commit | 85d89e767bb134b00064ee219f63860d06444913 (patch) | |
tree | 8acf15334fbe025b7be884c79c7e9d4f19fa984c /gcc/gimplify.c | |
parent | c5d434177058f2357999cdd060d5fe84c0a8cc64 (diff) | |
download | gcc-85d89e767bb134b00064ee219f63860d06444913.zip gcc-85d89e767bb134b00064ee219f63860d06444913.tar.gz gcc-85d89e767bb134b00064ee219f63860d06444913.tar.bz2 |
gimplify.c (gimplify_init_constructor): Arrange for the temporary captures of components overlapping the lhs to happen...
* gimplify.c (gimplify_init_constructor) <RECORD,UNION,ARRAY types>:
Arrange for the temporary captures of components overlapping the lhs
to happen before the lhs is possibly cleared.
testsuite/
* gnat.dg/self_aggregate_with_zeros.adb: New test.
* gnat.dg/self_aggregate_with_array.adb: New test.
From-SVN: r116300
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r-- | gcc/gimplify.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c index e2586a0..6ade10c 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -3061,6 +3061,20 @@ gimplify_init_constructor (tree *expr_p, tree *pre_p, } } + /* If there are nonzero elements, pre-evaluate to capture elements + overlapping with the lhs into temporaries. We must do this before + clearing to fetch the values before they are zeroed-out. */ + if (num_nonzero_elements > 0) + { + preeval_data.lhs_base_decl = get_base_address (object); + if (!DECL_P (preeval_data.lhs_base_decl)) + preeval_data.lhs_base_decl = NULL; + preeval_data.lhs_alias_set = get_alias_set (object); + + gimplify_init_ctor_preeval (&TREE_OPERAND (*expr_p, 1), + pre_p, post_p, &preeval_data); + } + if (cleared) { /* Zap the CONSTRUCTOR element list, which simplifies this case. @@ -3076,16 +3090,7 @@ gimplify_init_constructor (tree *expr_p, tree *pre_p, elements in the constructor, add assignments to the individual scalar fields of the object. */ if (!cleared || num_nonzero_elements > 0) - { - preeval_data.lhs_base_decl = get_base_address (object); - if (!DECL_P (preeval_data.lhs_base_decl)) - preeval_data.lhs_base_decl = NULL; - preeval_data.lhs_alias_set = get_alias_set (object); - - gimplify_init_ctor_preeval (&TREE_OPERAND (*expr_p, 1), - pre_p, post_p, &preeval_data); - gimplify_init_ctor_eval (object, elts, pre_p, cleared); - } + gimplify_init_ctor_eval (object, elts, pre_p, cleared); *expr_p = NULL_TREE; } |