[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ICE on procedure-local CONST declaration
From: |
Gaius Mulley |
Subject: |
Re: ICE on procedure-local CONST declaration |
Date: |
Tue, 16 Jul 2024 15:32:07 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) |
Alcor <alcor@tilde.club> writes:
> Hi all,
>
> The following program (Test.mod) causes an ICE on gm2 (GCC) 15.0.1 20240707
> (x86_64, Arch Linux):
>
> --
>
> MODULE Test;
>
> IMPORT SYSTEM;
>
> TYPE
> T = POINTER TO CONS;
> CONS = RECORD
> CAR: SYSTEM.ADDRESS;
> CDR: T;
> END;
>
> PROCEDURE POP(VAR LST: T): SYSTEM.ADDRESS;
> CONST CAR = LST.CAR;
> BEGIN
> RETURN NIL;
> END POP;
>
> BEGIN
> END Test.
>
> --
>
> I am not entirely sure whether this is valid Modula-2 code. I'm just
> experimenting with the compiler by attempting to write a toy Lisp
> implementation in M2 and thought this may be worth reporting.
>
Hi Alcor,
many thanks for the bug report - now fixed in the gcc git,
regards,
Gaius
$ gm2 -c badconst.mod
badconst.mod:13:13: error: In procedure ‘POP’: not expecting a variable ‘LST’
as a term in a constant expression
13 | CONST CAR = LST.CAR;
| ^~~