https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114055

            Bug ID: 114055
           Summary: poor error message generated during when checking the
                    BY constant expression type
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: modula2
          Assignee: gaius at gcc dot gnu.org
          Reporter: gaius at gcc dot gnu.org
  Target Milestone: ---

This is a minor follow on bug to 114026.

$ cat forloopby.mod
MODULE forloopby ;


PROCEDURE init ;
CONST
   increment = CARDINAL (1) ;
VAR
   i: INTEGER ;
BEGIN
   FOR i := 0 TO 10 BY increment DO
   END
END init ;


BEGIN
   init
END forloopby.

$ gm2 forloopby.mod 
forloopby.mod: In function ‘init’:
forloopby.mod:10:8: error: In procedure ‘init’: type incompatibility between
‘INTEGER’ and ‘CARDINAL’
   10 |    FOR i := 0 TO 10 BY increment DO
      |        ^

which could be improved to mention the BY constant expression and designator
expression type fail.

Reply via email to