[COMMITTED] algol68: fix handling of completed modes in a68_lower_moids

Jose E. Marchesi jemarch@gnu.org
Sat Sep 20 12:03:43 GMT 2025


---
 gcc/algol68/a68-low-moids.cc | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/gcc/algol68/a68-low-moids.cc b/gcc/algol68/a68-low-moids.cc
index 3de16684786..4dbf1189162 100644
--- a/gcc/algol68/a68-low-moids.cc
+++ b/gcc/algol68/a68-low-moids.cc
@@ -693,6 +693,7 @@ a68_lower_moids (MOID_T *mode)
 	  if (IS_STRUCT (m))
 	    {
 	      tree struct_type = CTYPE (m);
+	      layout_type (struct_type);
 	      compute_record_mode (struct_type);
 	    }
 	  else if (IS_UNION (m))
@@ -713,4 +714,16 @@ a68_lower_moids (MOID_T *mode)
 	    layout_type (CTYPE (m));
 	}
     }
+
+  /* Sanity check.  */
+  for (MOID_T *m = mode; m != NO_MOID; FORWARD (m))
+    {
+      gcc_assert (COMPLETE_TYPE_P (CTYPE (m)));
+      if (IS_UNION (m))
+	{
+	  tree union_type = CTYPE (m);
+	  tree c_union_type = TREE_TYPE (TREE_CHAIN (TYPE_FIELDS (union_type)));
+	  gcc_assert (COMPLETE_TYPE_P (c_union_type));
+	}
+    }
 }
-- 
2.30.2



More information about the Algol68 mailing list