The source code: MODULE tiny4 ; FROM SYSTEM IMPORT WORD ; PROCEDURE func () : WORD ; BEGIN RETURN WORD (0) END func ; VAR b: BITSET ; BEGIN b := func () - {6..31} END tiny4. when compiled should complain about BITSET rather than CARDINAL. $ gm2 tiny4.mod tiny4.mod:13:17: error: In program module 'tiny4': type incompatibility between 'CARDINAL' and 'WORD' 13 | b := func () - {6..31} | ~~~~~~~~^~~~~~~~~
Confirmed.
Created attachment 57725 [details] Proposed fix 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: * gm2-compiler/SymbolTable.mod (GetLowestType): Do not skip over a set type, but return sym. gcc/testsuite/ChangeLog: * gm2/pim/fail/badset7.mod: New test.
$ gm2 tiny4.mod tiny4.mod:13:17: error: In program module ‘tiny4’: type incompatibility between ‘BITSET’ and ‘WORD’ 13 | b := func () - {6..31} | ~~~~~~~~^~~~~~~~~
The master branch has been updated by Gaius Mulley <gaius@gcc.gnu.org>: https://gcc.gnu.org/g:d2029bbc69df7341775faf6cf1aa13d978c223a1 commit r14-9520-gd2029bbc69df7341775faf6cf1aa13d978c223a1 Author: Gaius Mulley <gaiusmod2@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 <gaiusmod2@gmail.com>
Closing now that the patch has been applied.