public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug modula2/114548] New: gm2 fails to identify variable in a const expression
@ 2024-04-01 16:27 gaius at gcc dot gnu.org
  2024-04-01 16:27 ` [Bug modula2/114548] " gaius at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: gaius at gcc dot gnu.org @ 2024-04-01 16:27 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-04-01 18:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-01 16:27 [Bug modula2/114548] New: gm2 fails to identify variable in a const expression gaius at gcc dot gnu.org
2024-04-01 16:27 ` [Bug modula2/114548] " gaius at gcc dot gnu.org
2024-04-01 16:28 ` gaius at gcc dot gnu.org
2024-04-01 16:44 ` gaius at gcc dot gnu.org
2024-04-01 18:20 ` cvs-commit at gcc dot gnu.org
2024-04-01 18:20 ` gaius at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).