[COMMITTED] a68: do not generate TYPE_DECLs with null DECL_NAMEs

Jose E. Marchesi jemarch@gnu.org
Sun Sep 27 08:35:21 GMT 2026


This code in a68-low-moids.cc was leading to struct and union types
being emitted with TYPE_DECLs in their TYPE_NAMEs having null
DECL_NAMEs, which is a no-no.  Algol 68 struct and union modes are
always anonymous, until they are given names in a mode declaration.

Signed-of-by: Jose E. Marchesi <jemarch@gnu.org>

gcc/algol68/ChangeLog

	* a68-low-moids.cc (build_stub_type_decl): Remove function.
	(lower_struct_mode): Do not call build_stub_type_decl.
	(lower_union_mode): Likewise.
---
 gcc/algol68/a68-low-moids.cc | 26 --------------------------
 1 file changed, 26 deletions(-)

diff --git a/gcc/algol68/a68-low-moids.cc b/gcc/algol68/a68-low-moids.cc
index 27b28173003..54c1a42863d 100644
--- a/gcc/algol68/a68-low-moids.cc
+++ b/gcc/algol68/a68-low-moids.cc
@@ -49,23 +49,6 @@ static tree a68_lower_mode (MOID_T *m);
    This is used for TYPE_STUB_DECL so we can generate debug info for all our
    modes, so the TYPE_DECL has no name.  */
 
-static void
-build_stub_type_decl (tree type, tree context)
-{
-  if (TYPE_STUB_DECL (type))
-    return;
-
-  tree decl = build_decl (UNKNOWN_LOCATION,
-			  TYPE_DECL,
-			  NULL_TREE /* name */,
-			  type);
-  TREE_PUBLIC (decl) = 1;
-  DECL_CONTEXT (decl) = context;
-  TYPE_CONTEXT (type) = DECL_CONTEXT (decl);
-  TYPE_NAME (type) = decl; /* Weird.  This is for typedefs! */
-  TYPE_STUB_DECL (type) = decl;
-}
-
 /* Builds a record type whose name is NAME.  NFIELDS is the number of fields,
    provided as field ident/type pairs.
 
@@ -311,10 +294,6 @@ lower_struct_mode (MOID_T *m)
       compute_record_mode (struct_type);
     }
 
-  /* Finish debugging output for this type.  */
-  build_stub_type_decl (struct_type, NULL_TREE /* context */);
-  rest_of_type_compilation (struct_type, TYPE_FILE_SCOPE_P (struct_type));
-  rest_of_decl_compilation (TYPE_NAME (struct_type), 1 /* file scope p */, 0);
   A68_STRUCT_TYPE_P (struct_type) = 1;
   return struct_type;
 }
@@ -429,11 +408,6 @@ lower_union_mode (MOID_T *m)
       compute_record_mode (c_union_type);
     }
 
-  /* Finish debugging output for this type.  */
-  build_stub_type_decl (c_union_type, NULL_TREE /* context */);
-  rest_of_type_compilation (c_union_type, TYPE_FILE_SCOPE_P (c_union_type));
-  rest_of_decl_compilation (TYPE_NAME (c_union_type), 1 /* file scope p */, 0);
-
   /* Now the type with the overhead.  */
   TYPE_NAME (union_type) = get_identifier ("union%");
   tree overhead_field = build_decl (UNKNOWN_LOCATION, FIELD_DECL,
-- 
2.39.5



More information about the Algol68 mailing list