]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR modula2/114422 Attempting to declare a set of unknown type causes ICE
authorGaius Mulley <gaiusmod2@gmail.com>
Fri, 22 Mar 2024 01:47:31 +0000 (01:47 +0000)
committerGaius Mulley <gaiusmod2@gmail.com>
Fri, 22 Mar 2024 01:47:31 +0000 (01:47 +0000)
This patch corrects an error message directive which did not
escape the { character.  The patch also contains test cases
to stress set declaration errors.

gcc/m2/ChangeLog:

PR modula2/114422
* gm2-compiler/M2Quads.mod (BuildConstructor): Add escape
character.

gcc/testsuite/ChangeLog:

PR modula2/114422
* gm2/iso/fail/badset.mod: New test.
* gm2/iso/fail/badset2.mod: New test.
* gm2/iso/fail/badset3.mod: New test.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
gcc/m2/gm2-compiler/M2Quads.mod
gcc/testsuite/gm2/iso/fail/badset.mod [new file with mode: 0644]
gcc/testsuite/gm2/iso/fail/badset2.mod [new file with mode: 0644]
gcc/testsuite/gm2/iso/fail/badset3.mod [new file with mode: 0644]

index ac654e89c917f8f869400ed9bf77ea9145df3799..52d72f6cd6284a85359e5a21083547d8f5c0e16a 100644 (file)
@@ -12172,7 +12172,7 @@ BEGIN
    IF type = NulSym
    THEN
       MetaErrorT0 (tokcbrpos,
-                   '{%E}constructor requires a type before the opening {')
+                   '{%E}constructor requires a type before the opening %{')
    ELSE
       ChangeToConstructor (tok, type) ;
       PutConstructorFrom (constValue, type) ;
diff --git a/gcc/testsuite/gm2/iso/fail/badset.mod b/gcc/testsuite/gm2/iso/fail/badset.mod
new file mode 100644 (file)
index 0000000..8bfc49f
--- /dev/null
@@ -0,0 +1,7 @@
+MODULE badset ;
+
+VAR
+   set: set ;
+BEGIN
+
+END badset.
diff --git a/gcc/testsuite/gm2/iso/fail/badset2.mod b/gcc/testsuite/gm2/iso/fail/badset2.mod
new file mode 100644 (file)
index 0000000..d883d1f
--- /dev/null
@@ -0,0 +1,9 @@
+MODULE badset2 ;
+
+TYPE
+   userset = SET OF CHAR ;
+VAR
+   set: userset ;
+BEGIN
+   set := set {}
+END badset2.
diff --git a/gcc/testsuite/gm2/iso/fail/badset3.mod b/gcc/testsuite/gm2/iso/fail/badset3.mod
new file mode 100644 (file)
index 0000000..29131ff
--- /dev/null
@@ -0,0 +1,9 @@
+MODULE badset3 ;
+
+TYPE
+   userset = SET OF CHAR ;
+VAR
+   set: userset ;
+BEGIN
+   set := unknown {}
+END badset3.