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

--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Gaius Mulley <ga...@gcc.gnu.org>:

https://gcc.gnu.org/g:c1667b1ef538e4da10cf83bdf1ae62d7bdd96128

commit r14-9136-gc1667b1ef538e4da10cf83bdf1ae62d7bdd96128
Author: Gaius Mulley <gaiusm...@gmail.com>
Date:   Thu Feb 22 15:02:19 2024 +0000

    PR modula2/114055 improve error message when checking the BY constant

    The fix marks a constant created during the default BY clause of the
    FOR loop as internal.  The type checker will always return true if
    checking against an internal const.

    gcc/m2/ChangeLog:

            PR modula2/114055
            * gm2-compiler/M2Check.mod (Import): IsConstLitInternal and
            IsConstLit.
            (isInternal): New procedure function.
            (doCheck): Test for isInternal in either operand and early
            return true.
            * gm2-compiler/M2Quads.mod (PushOne): Rewrite with extra
            parameter internal.
            (BuildPseudoBy): Add TRUE parameter to PushOne call.
            (BuildIncProcedure): Add FALSE parameter to PushOne call.
            (BuildDecProcedure): Add FALSE parameter to PushOne call.
            * gm2-compiler/M2Range.mod (ForLoopBeginTypeCompatible):
            Uncomment code and tidy up error string.
            * gm2-compiler/SymbolTable.def (PutConstLitInternal):
            New procedure.
            (IsConstLitInternal): New procedure function.
            * gm2-compiler/SymbolTable.mod (PutConstLitInternal):
            New procedure.
            (IsConstLitInternal): New procedure function.
            (SymConstLit): New field IsInternal.
            (CreateConstLit): Initialize IsInternal to FALSE.

    gcc/testsuite/ChangeLog:

            PR modula2/114055
            * gm2/pim/fail/forloopby.mod: New test.
            * gm2/pim/pass/forloopby2.mod: New test.

    Signed-off-by: Gaius Mulley <gaiusm...@gmail.com>

Reply via email to