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

--- Comment #2 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:f065c582d9c8e0a4fee7ee563c584ee3b1975bea

commit r14-9506-gf065c582d9c8e0a4fee7ee563c584ee3b1975bea
Author: Gaius Mulley <gaiusm...@gmail.com>
Date:   Sun Mar 17 14:49:23 2024 +0000

    PR modula2/114296 ICE when attempting to create a constant set with a
variable element

    This patch corrects the virtual token creation for the aggregate constant
    and also corrects tokens for constructor components.

    gcc/m2/ChangeLog:

            PR modula2/114296
            * gm2-compiler/M2ALU.mod (ElementsSolved): Add tokenno parameter.
            Add constant checks and generate error messages.
            (EvalSetValues): Pass tokenno parameter to ElementsSolved.
            * gm2-compiler/M2LexBuf.mod (stop): New procedure.
            (MakeVirtualTok): Call stop if caret = BadTokenNo.
            * gm2-compiler/M2Quads.def (BuildNulExpression): Add tokpos
            parameter.
            (BuildSetStart): Ditto.
            (BuildEmptySet): Ditto.
            (BuildConstructorEnd): Add startpos parameter.
            (BuildTypeForConstructor): Add tokpos parameter.
            * gm2-compiler/M2Quads.mod (BuildNulExpression): Add tokpos
            parameter and push tokpos to the quad stack.
            (BuildSetStart): Add tokpos parameter and push tokpos.
            (BuildSetEnd): Rewrite.
            (BuildEmptySet): Add tokpos parameter and push tokpos with
            the set type.
            (BuildConstructorStart): Pop typepos.
            (BuildConstructorEnd): Add startpos parameter.
            Create valtok from startpos and cbratokpos.
            (BuildTypeForConstructor): Add tokpos parameter.
            * gm2-compiler/M2Range.def (InitAssignmentRangeCheck): Rename
            d to des and e to expr.
            Add destok and exprtok parameters.
            * gm2-compiler/M2Range.mod (InitAssignmentRangeCheck): Rename
            d to des and e to expr.
            Add destok and exprtok parameters.
            Save destok and exprtok into range record.
            (FoldAssignment): Pass exprtok to TryDeclareConstant.
            * gm2-compiler/P3Build.bnf (ComponentValue): Rewrite.
            (Constructor): Rewrite.
            (ConstSetOrQualidentOrFunction): Rewrite.
            (SetOrQualidentOrFunction): Rewrite.
            * gm2-compiler/PCBuild.bnf (ConstSetOrQualidentOrFunction):
Rewrite.
            (SetOrQualidentOrFunction): Rewrite.
            * gm2-compiler/PHBuild.bnf (Constructor): Rewrite.
            (ConstSetOrQualidentOrFunction): Rewrite.

    gcc/testsuite/ChangeLog:

            PR modula2/114296
            * gm2/pim/fail/badtype2.mod: New test.

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

Reply via email to