+2006-08-21 Olivier Hainque <hainque@adacore.com>
+
+ * 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.
+
2006-08-21 Mark Shinwell <shinwell@codesourcery.com>
* config/arm/pr-support.c (__gnu_unwind_execute): Insert " + 1" in
}
}
+ /* 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.
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;
}
--- /dev/null
+-- { dg-do run }
+
+procedure self_aggregate_with_zeros is
+
+ type Sensor is record
+ Value : Natural;
+ A, B, C, D, E, F, G, H, I, J, K, L, M : Natural;
+ end record;
+
+ Pressure : Sensor;
+
+begin
+ Pressure.Value := 256;
+ Pressure := (Pressure.Value, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+
+ if Pressure.Value /= 256 then
+ raise Program_Error;
+ end if;
+end;