diff mbox series

[c-family] Small fix to implementation of -fdump-ada-spec

Message ID 4892060.GXAFRqVoOG@fomalhaut
State New
Headers show
Series [c-family] Small fix to implementation of -fdump-ada-spec | expand

Commit Message

Eric Botcazou May 17, 2024, 9:46 a.m. UTC
This avoids declaring anonymous array types as having an aliased component 
when the layout is packed, as is already done for named array types.

Tested on x86-64/Linux, applied on the mainline.


2024-05-17  Eric Botcazou  <ebotcazou@adacore.com>

	* c-ada-spec.cc (bitfield_used): Move around.
	(packed_layout): Likewise.
	(dump_ada_array_type): Do not put "aliased" for a packed layout.
diff mbox series

Patch

diff --git a/gcc/c-family/c-ada-spec.cc b/gcc/c-family/c-ada-spec.cc
index e56ef10f443..46fee30b6b9 100644
--- a/gcc/c-family/c-ada-spec.cc
+++ b/gcc/c-family/c-ada-spec.cc
@@ -699,6 +699,8 @@  compare_comment (const void *lp, const void *rp)
 
 static tree *to_dump = NULL;
 static int to_dump_count = 0;
+static bool bitfield_used = false;
+static bool packed_layout = false;
 
 /* Collect a list of declarations from T relevant to SOURCE_FILE to be dumped
    by a subsequent call to dump_ada_nodes.  */
@@ -1825,7 +1827,7 @@  dump_ada_array_type (pretty_printer *buffer, tree node, int spc)
 
       pp_string (buffer, " of ");
 
-      if (TREE_CODE (tmp) != POINTER_TYPE)
+      if (TREE_CODE (tmp) != POINTER_TYPE && !packed_layout)
 	pp_string (buffer, "aliased ");
 
       if (TYPE_NAME (tmp)
@@ -2083,9 +2085,6 @@  is_float128 (tree node)
 	 || id_equal (name, "_Float128x");
 }
 
-static bool bitfield_used = false;
-static bool packed_layout = false;
-
 /* Recursively dump in BUFFER Ada declarations corresponding to NODE of type
    TYPE.  SPC is the indentation level.  LIMITED_ACCESS indicates whether NODE
    can be referenced via a "limited with" clause.  NAME_ONLY indicates whether