https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114548
Bug ID: 114548
Summary: gm2 fails to identify variable in a const expression
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: modula2
Assignee: gaius at gcc dot gnu.org
Reporter: gaius at gcc dot gnu.org
Target Milestone: ---
As reported on the gm2 mailing list.
gm2 fails to identify the specific variable within a const expression. It
gives an error for the whole expression rather than the sub expression in
error.
For example:
$ cat testcmplx.mod
MODULE testcmplx ;
CONST
foo = CMPLX (r, i) ;
VAR
r, i: REAL ;
BEGIN
END testcmplx.
$ gm2 -fiso testcmplx.mod
testcmplx.mod:4:8: error: In program module ‘testcmplx’: in assignment, cannot
assign a variable to a constant ‘foo’
4 | foo = CMPLX (r, i) ;
| ~~~~^~~~~~~~~~~~~
testcmplx.mod:4:4: error: designator ‘foo’ is declared as a CONST
4 | foo = CMPLX (r, i) ;
| ^~~
it could identify r and i as variables.