https://gcc.gnu.org/g:c94dbb388de5ecb06f61ad3972eaff4d77933f81

commit r17-4683-gc94dbb388de5ecb06f61ad3972eaff4d77933f81
Author: Jose E. Marchesi <[email protected]>
Date:   Sun Sep 27 09:59:16 2026 +0200

    a68: do not generate TYPE_DECLs with null DECL_NAMEs
    
    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 <[email protected]>
    
    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.

Diff:
---
 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 27b28173003f..54c1a42863d9 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,

Reply via email to