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

commit r14-9520-gd2029bbc69df7341775faf6cf1aa13d978c223a1
Author: Gaius Mulley <gaiusm...@gmail.com>
Date:   Mon Mar 18 16:40:35 2024 +0000

    PR modula2/114380 Incorrect type specified in an error message
    
    This patch corrects an error message relating to a variable of
    a SET type. The bugfix is not to skip over set types (in
    GetLowestType).
    
    gcc/m2/ChangeLog:
    
            PR modula2/114380
            * gm2-compiler/SymbolTable.mod (GetLowestType): Do not
            skip over a set type, but return sym.
    
    gcc/testsuite/ChangeLog:
    
            PR modula2/114380
            * gm2/pim/fail/badset7.mod: New test.
    
    Signed-off-by: Gaius Mulley <gaiusm...@gmail.com>

Diff:
---
 gcc/m2/gm2-compiler/SymbolTable.mod    |  2 +-
 gcc/testsuite/gm2/pim/fail/badset7.mod | 14 ++++++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/gcc/m2/gm2-compiler/SymbolTable.mod 
b/gcc/m2/gm2-compiler/SymbolTable.mod
index c08de6a97c3..9d572cff19c 100644
--- a/gcc/m2/gm2-compiler/SymbolTable.mod
+++ b/gcc/m2/gm2-compiler/SymbolTable.mod
@@ -6154,7 +6154,7 @@ BEGIN
       SubrangeSym         : type := Subrange.Type |
       ArraySym            : type := Array.Type |
       SubscriptSym        : type := Subscript.Type |
-      SetSym              : type := Set.Type |
+      SetSym              : type := Sym |    (* Stop at the set type.  *)
       UnboundedSym        : type := Unbounded.Type |
       UndefinedSym        : type := NulSym |
       DummySym            : type := NulSym
diff --git a/gcc/testsuite/gm2/pim/fail/badset7.mod 
b/gcc/testsuite/gm2/pim/fail/badset7.mod
new file mode 100644
index 00000000000..5c2499be739
--- /dev/null
+++ b/gcc/testsuite/gm2/pim/fail/badset7.mod
@@ -0,0 +1,14 @@
+MODULE badset7 ;
+
+FROM SYSTEM IMPORT WORD ;
+
+PROCEDURE func () : WORD ;
+BEGIN
+   RETURN WORD (0)
+END func ;
+
+VAR
+   b: BITSET ;
+BEGIN
+   b := func () - {6..31}
+END badset7.

Reply via email to