diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2023-04-15 19:35:02 +0200 |
---|---|---|
committer | Eric Botcazou <ebotcazou@adacore.com> | 2023-04-15 19:35:02 +0200 |
commit | 2e2b6ec156e3035297bd76edfd462d68d1f87314 (patch) | |
tree | 278a5218251a2d32ad59147a04ac07b74bc406de /gcc/ada/gcc-interface | |
parent | 4f1c5e54d782b26304b0095ffb3ceb4c92c3c78d (diff) | |
download | gcc-2e2b6ec156e3035297bd76edfd462d68d1f87314.zip gcc-2e2b6ec156e3035297bd76edfd462d68d1f87314.tar.gz gcc-2e2b6ec156e3035297bd76edfd462d68d1f87314.tar.bz2 |
Fix fallout of previous change on x86/Linux
gcc/ada/
PR bootstrap/109510
* gcc-interface/decl.cc (gnat_to_gnu_entity) <types>: Do not reset
align to zero in any case. Set TYPE_USER_ALIGN on the type only if
it is an aggregate type, or else a type whose default alignment is
specifically capped on selected platforms.
Diffstat (limited to 'gcc/ada/gcc-interface')
-rw-r--r-- | gcc/ada/gcc-interface/decl.cc | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/gcc/ada/gcc-interface/decl.cc b/gcc/ada/gcc-interface/decl.cc index 851a674..20f43de 100644 --- a/gcc/ada/gcc-interface/decl.cc +++ b/gcc/ada/gcc-interface/decl.cc @@ -4371,10 +4371,6 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) align = validate_alignment (Alignment (gnat_entity), gnat_entity, TYPE_ALIGN (gnu_type)); - /* Treat confirming clauses on scalar types like the default. */ - if (align == TYPE_ALIGN (gnu_type) && !AGGREGATE_TYPE_P (gnu_type)) - align = 0; - /* Warn on suspiciously large alignments. This should catch errors about the (alignment,byte)/(size,bit) discrepancy. */ if (align > BIGGEST_ALIGNMENT && Has_Alignment_Clause (gnat_entity)) @@ -4657,6 +4653,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) /* If this is not an unconstrained array type, set some flags. */ if (TREE_CODE (gnu_type) != UNCONSTRAINED_ARRAY_TYPE) { + bool align_clause; + /* Record the property that objects of tagged types are guaranteed to be properly aligned. This is necessary because conversions to the class-wide type are translated into conversions to the root type, @@ -4669,8 +4667,20 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) if (is_by_ref && !VOID_TYPE_P (gnu_type)) TYPE_BY_REFERENCE_P (gnu_type) = 1; - /* Record whether an alignment clause was specified. */ - if (align > 0 && Present (Alignment_Clause (gnat_entity))) + /* Record whether an alignment clause was specified. At this point + scalar types with a non-confirming clause have been wrapped into + a record type, so only scalar types with a confirming clause are + left untouched; we do not set the flag on them except if they are + types whose default alignment is specifically capped in order not + to lose the specified alignment. */ + if ((AGGREGATE_TYPE_P (gnu_type) + && Present (Alignment_Clause (gnat_entity))) + || (double_float_alignment > 0 + && is_double_float_or_array (gnat_entity, &align_clause) + && align_clause) + || (double_scalar_alignment > 0 + && is_double_scalar_or_array (gnat_entity, &align_clause) + && align_clause)) TYPE_USER_ALIGN (gnu_type) = 1; /* Record whether a pragma Universal_Aliasing was specified. */ |