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

--- Comment #3 from Gaius Mulley <gaius at gcc dot gnu.org> ---
Created attachment 59604
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59604&action=edit
Proposed fix

Thanks for the bug report.  The error location was missing and here is a
proposed fix.  All language dialects expect the FOR loop increment expression
to be constant (which was not enforced prior to the patch), now fixed.

The result from gcc-15 with the patch is:

$ gm2 primes.mod 
primes.mod:18:48: error: In procedure ‘Compute_Primes’: the FOR loop BY
expression must be constant, the expression ‘k’ is variable
   18 |           FOR m := k * k TO HIGH (is_prime) BY k DO (* line 20 *)
      |                                                ^
primes.mod:8:6: error: variable declaration for ‘k’
    8 |      k, m : CARDINAL; (* line 10 *)
      |      ^~~~~~~~~~~~~~~

Reply via email to