[COMMITTED] algol68: fix typo in a68_lower_moids and add test
Jose E. Marchesi
jemarch@gnu.org
Fri Apr 4 20:23:50 GMT 2025
---
gcc/algol68/a68-low-moids.cc | 4 +--
.../algol68/compile/recursive-modes-1.a68 | 31 +++++++++++++++++++
2 files changed, 33 insertions(+), 2 deletions(-)
create mode 100644 gcc/testsuite/algol68/compile/recursive-modes-1.a68
diff --git a/gcc/algol68/a68-low-moids.cc b/gcc/algol68/a68-low-moids.cc
index 653eb1fcf90..2223ffcf673 100644
--- a/gcc/algol68/a68-low-moids.cc
+++ b/gcc/algol68/a68-low-moids.cc
@@ -459,7 +459,7 @@ lower_union_mode (MOID_T *m)
TYPE_FORWARD_REFERENCES (union_type));
TYPE_FORWARD_REFERENCES (union_type) = forward_refs;
}
-
+
SET_TYPE_STRUCTURAL_EQUALITY (union_type);
A68_UNION_TYPE_P (union_type) = 1;
return union_type;
@@ -715,7 +715,7 @@ a68_lower_moids (MOID_T *mode)
compute_record_mode (c_union_type);
}
- layout_type (c_union_type);
+ layout_type (union_type);
compute_record_mode (union_type);
}
else
diff --git a/gcc/testsuite/algol68/compile/recursive-modes-1.a68 b/gcc/testsuite/algol68/compile/recursive-modes-1.a68
new file mode 100644
index 00000000000..1eaad9c263b
--- /dev/null
+++ b/gcc/testsuite/algol68/compile/recursive-modes-1.a68
@@ -0,0 +1,31 @@
+# This program triggered a bug related to incomplete modes. #
+BEGIN MODE REC_MSET = STRUCT (REF REC_MSET_ELM head, tail,
+ INT num elems,
+ PROC(REC_MSET_DATA)BOOL gate),
+ REC_MSET_ELM = STRUCT (REC_MSET_DATA data, BOOL mark, REF REC_MSET_ELM next),
+ REC_MSET_DATA = UNION (REC_RSET,REC_RECORD,REC_FIELD,REC_CMNT),
+ REC_RSET = STRUCT (REC_MSET mset,
+ INT min size, max size,
+ REF REC_RECORD descriptor),
+ REC_RECORD = STRUCT (REC_LOC loc, REC_MSET mset, INT foo),
+ REC_CMNT = STRUCT (REC_LOC loc, STRING content),
+ REC_FIELD = STRUCT (REC_LOC loc, STRING name, value),
+ REC_LOC = STRUCT (STRING source, INT line, char);
+
+ PROC rec loc unknown = REC_LOC:
+ ("unknown", 0, 0);
+ PROC rec record gate = (REC_MSET_DATA d) BOOL:
+ (d | (REC_FIELD): TRUE, (REC_CMNT): TRUE | FALSE);
+ REF REC_MSET_ELM rec no mset elm = NIL;
+
+ PROC rec mset new = (PROC(REC_MSET_DATA)BOOL gate) REC_MSET:
+ (HEAP REC_MSET := (rec no mset elm, rec no mset elm,
+ 0, gate));
+
+ REF REC_RECORD rec no record = NIL;
+
+ PROC rec record new = REF REC_RECORD:
+ HEAP REC_RECORD := (rec loc unknown, rec mset new (rec record gate), 0);
+
+ SKIP
+END
--
2.30.2
More information about the Algol68
mailing list