public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-7187] Fix build failure of Ada runtime for Aarch64 targets
@ 2023-04-14 18:18 Eric Botcazou
  0 siblings, 0 replies; only message in thread
From: Eric Botcazou @ 2023-04-14 18:18 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:94a21e008c4778e446321b1355f61abc75a076be

commit r13-7187-g94a21e008c4778e446321b1355f61abc75a076be
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Fri Apr 14 20:14:07 2023 +0200

    Fix build failure of Ada runtime for Aarch64 targets
    
    The Aarch64 back-end now asserts that the main variant of scalar types
    has TYPE_USER_ALIGN cleared, and that's not the case for scalar types
    declared with a confirming alignment clause in Ada.
    
    gcc/ada/
            PR bootstrap/109510
            * gcc-interface/decl.cc (gnat_to_gnu_entity) <types>: Reset align
            to zero if its value is equal to TYPE_ALIGN and the type is scalar.
            Set TYPE_USER_ALIGN on the type only if align is positive.

Diff:
---
 gcc/ada/gcc-interface/decl.cc | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/gcc/ada/gcc-interface/decl.cc b/gcc/ada/gcc-interface/decl.cc
index d24adf33601..851a6745f77 100644
--- a/gcc/ada/gcc-interface/decl.cc
+++ b/gcc/ada/gcc-interface/decl.cc
@@ -4364,13 +4364,17 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
       /* If the alignment has not already been processed and this is not
 	 an unconstrained array type, see if an alignment is specified.
 	 If not, we pick a default alignment for atomic objects.  */
-      if (align != 0 || TREE_CODE (gnu_type) == UNCONSTRAINED_ARRAY_TYPE)
+      if (align > 0 || TREE_CODE (gnu_type) == UNCONSTRAINED_ARRAY_TYPE)
 	;
       else if (Known_Alignment (gnat_entity))
 	{
 	  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))
@@ -4666,7 +4670,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
 	    TYPE_BY_REFERENCE_P (gnu_type) = 1;
 
 	  /* Record whether an alignment clause was specified.  */
-	  if (Present (Alignment_Clause (gnat_entity)))
+	  if (align > 0 && Present (Alignment_Clause (gnat_entity)))
 	    TYPE_USER_ALIGN (gnu_type) = 1;
 
 	  /* Record whether a pragma Universal_Aliasing was specified.  */

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-04-14 18:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-14 18:18 [gcc r13-7187] Fix build failure of Ada runtime for Aarch64 targets Eric Botcazou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).