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

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

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

commit r15-9995-gba085e56d07c085be4688506b4a2cf1bbc11b528
Author: Gaius Mulley <gaiusm...@gmail.com>
Date:   Fri Jul 18 01:47:40 2025 +0100

    [PATCH] PR modula2/120673: Mutually dependent types crash the compiler

    This patch fixes an ICE which will occur if cyclic dependent types
    are used when declaring a variable.  This patch detects the
    cyclic dependency and issues an error message for each outstanding
    component.

    gcc/m2/ChangeLog:

            PR modula2/120673
            * gm2-compiler/M2GCCDeclare.mod (ErrorDepList): New
            global variable set containing every errant dependency symbol.
            (mystop): Remove.
            (EmitCircularDependancyError): Replace with ...
            (EmitCircularDependencyError): ... this.
            (AssertAllTypesDeclared): Rewrite.
            (DoVariableDeclaration): Ditto.
            (TypeDependentsDeclared): New procedure function.
            (PrepareGCCVarDeclaration): Ditto.
            (DeclareVariable): Remove assert.
            (DeclareLocalVariable): Ditto.
            (Constructor): Initialize ErrorDepList.
            * gm2-compiler/M2MetaError.mod (doErrorScopeProc): Rewrite
            and ensure that a symbol with a module scope does not lookup
            from a definition module.
            * gm2-compiler/P2SymBuild.mod (BuildType): Rewrite so that
            a synonym type is created using the token refering to the name
            on the lhs.

    gcc/testsuite/ChangeLog:

            PR modula2/120673
            * gm2/pim/fail/badmodvar.mod: New test.
            * gm2/pim/fail/cyclictypes.mod: New test.
            * gm2/pim/fail/cyclictypes2.mod: New test.
            * gm2/pim/fail/cyclictypes4.mod: New test.

    (cherry picked from commit fba2f08152375e2c1c167ec921a0197e4c07efc6)

    Signed-off-by: Gaius Mulley <gaiusm...@gmail.com>
  • [Bug modula2/120673] Mutually d... cvs-commit at gcc dot gnu.org via Gcc-bugs

Reply via email to