aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/utils.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2018-12-11 11:11:31 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2018-12-11 11:11:31 +0000
commit6186a6ef3c5d54134e68a0f54ad736e405876269 (patch)
treeb70f11386b52bb051ba0a8178d21ea4101368992 /gcc/ada/gcc-interface/utils.c
parentaf3ded0832bd13e8f00fc62d96a367635398d1d6 (diff)
downloadgcc-6186a6ef3c5d54134e68a0f54ad736e405876269.zip
gcc-6186a6ef3c5d54134e68a0f54ad736e405876269.tar.gz
gcc-6186a6ef3c5d54134e68a0f54ad736e405876269.tar.bz2
[Ada] Fix elaboration of record with 1-element dynamic array
2018-12-11 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * einfo.ads (Is_Bit_Packed_Array): Fix values of component size. (Is_Packed): Likewise. * gcc-interface/utils.c (convert): Do not extract the value of a justified modular type if the destination type is a regular array. * gcc-interface/decl.c (gnat_to_gnu_component_type): Pass TYPE_DECL to validate_size wherever the array has packed components. From-SVN: r267005
Diffstat (limited to 'gcc/ada/gcc-interface/utils.c')
-rw-r--r--gcc/ada/gcc-interface/utils.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c
index 5646051..24d8cd9 100644
--- a/gcc/ada/gcc-interface/utils.c
+++ b/gcc/ada/gcc-interface/utils.c
@@ -4361,12 +4361,13 @@ convert (tree type, tree expr)
TYPE_MIN_VALUE (etype))));
/* If the input is a justified modular type, we need to extract the actual
- object before converting it to any other type with the exceptions of an
- unconstrained array or of a mere type variant. It is useful to avoid the
- extraction and conversion in the type variant case because it could end
- up replacing a VAR_DECL expr by a constructor and we might be about the
- take the address of the result. */
+ object before converting it to an other type with the exceptions of an
+ [unconstrained] array or a mere type variant. It is useful to avoid
+ the extraction and conversion in these cases because it could end up
+ replacing a VAR_DECL by a constructor and we might be about the take
+ the address of the result. */
if (ecode == RECORD_TYPE && TYPE_JUSTIFIED_MODULAR_P (etype)
+ && code != ARRAY_TYPE
&& code != UNCONSTRAINED_ARRAY_TYPE
&& TYPE_MAIN_VARIANT (type) != TYPE_MAIN_VARIANT (etype))
return