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

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

https://gcc.gnu.org/g:99d537558ebffb52cb8f784ab550b962958fedef

commit r14-10982-g99d537558ebffb52cb8f784ab550b962958fedef
Author: Gaius Mulley <gaiusm...@gmail.com>
Date:   Tue Nov 26 12:57:12 2024 +0000

    [PATCH] PR modula2/115957 ICE on procedure local const declaration

    An ICE would occur if a constant was declared using a variable term.
    This fix catches variable terms in constant expressions and generates
    an unrecoverable error.

    gcc/m2/ChangeLog:

            PR modula2/115957
            * gm2-compiler/M2StackAddress.mod (PopAddress): Detect tail=NIL
            and generate an internal error.
            * gm2-compiler/PCBuild.bnf (InConstParameter): New variable.
            (InConstBlock): New variable.
            (ErrorString): Rewrite using MetaErrorStringT0.
            (ErrorArrayAt): Rewrite using MetaErrorStringT0.
            (WarnMissingToken): Use MetaErrorStringT0.
            (CompilationUnit): Set seenError FALSE.
            (init): Initialize InConstParameter and InConstBlock.
            (ConstantDeclaration): Set InConstBlock.
            (ConstSetOrQualidentOrFunction): Call CheckNotVar if not
            InConstParameter and InConstBlock.
            (ConstActualParameters): Set InConstParameter TRUE and restore
            value at the end.
            * gm2-compiler/PCSymBuild.def (CheckNotVar): New procedure.
            Remove all unnecessary export qualified list.
            * gm2-compiler/PCSymBuild.mod (CheckNotVar): New procedure.

    gcc/testsuite/ChangeLog:

            PR modula2/115957
            * gm2/errors/fail/badconst.mod: New test.
            * gm2/pim/fail/tinyadr.mod: New test.

    (cherry picked from commit d9709fafb2c498ba2f4c920f953c9b78fa3bf114)

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

Reply via email to