diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2021-11-17 00:09:56 +0100 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2021-12-02 16:26:31 +0000 |
commit | 5a11ffadf58a3668655e08f610281ac5567b4d93 (patch) | |
tree | 5d4bf3f53bbf4ab6414139a4414798a40fa02df1 /gcc/ada/gcc-interface/decl.c | |
parent | 9e10b7002acb3ce6134a6343cba04691f8c2d8ff (diff) | |
download | gcc-5a11ffadf58a3668655e08f610281ac5567b4d93.zip gcc-5a11ffadf58a3668655e08f610281ac5567b4d93.tar.gz gcc-5a11ffadf58a3668655e08f610281ac5567b4d93.tar.bz2 |
[Ada] Fix packing for array component with discriminated part
gcc/ada/
* gcc-interface/gigi.h (aggregate_type_contains_array_p): Delete.
(type_has_variable_size): Declare.
* gcc-interface/decl.c (adjust_packed): Return 0 only if the field
type is an array with variable size.
* gcc-interface/utils.c (aggregate_type_contains_array_p): Make
static and remove SELF_REFERENTIAL parameter.
(type_has_variable_size): Make public.
(create_field_decl): Adjust call to aggregate_type_contains_array_p.
Diffstat (limited to 'gcc/ada/gcc-interface/decl.c')
-rw-r--r-- | gcc/ada/gcc-interface/decl.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 3d14b5f..f0c17fc 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -7221,13 +7221,12 @@ choices_to_gnu (tree gnu_operand, Node_Id gnat_choices) static int adjust_packed (tree field_type, tree record_type, int packed) { - /* If the field contains an array with self-referential size, we'd better - not pack it because this would misalign it and, therefore, cause large - temporaries to be created in case we need to take the address of the - field. See addressable_p and the notes on the addressability issues - for further details. */ - if (AGGREGATE_TYPE_P (field_type) - && aggregate_type_contains_array_p (field_type, true)) + /* If the field is an array of variable size, we'd better not pack it because + this would misalign it and, therefore, probably cause large temporarie to + be created in case we need to take its address. See addressable_p and the + notes on the addressability issues for further details. */ + if (TREE_CODE (field_type) == ARRAY_TYPE + && type_has_variable_size (field_type)) return 0; /* In the other cases, we can honor the packing. */ |