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

--- 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:e3632a18d1e0b94b4c7b99a512b19c830ed3b228

commit r14-7064-ge3632a18d1e0b94b4c7b99a512b19c830ed3b228
Author: Gaius Mulley <gaiusm...@gmail.com>
Date:   Tue Jan 9 13:36:44 2024 +0000

    PR modula2/112920 cc1gm2 hangs in the type resolver

    This patch contains a fix to gcc/m2/gm2-compiler/M2GCCDeclare.mod.
    The fix introduces a group of sets which can be compared.  The resolver
    will loop until there is no change in all sets within the group.
    Since symbols migrate from set to set without ever looping this
    will never hang.  Previously only the number of elements in a set
    were compared which resulted in a infinite spin.

    gcc/m2/ChangeLog:

            PR modula2/112920
            * gm2-compiler/M2GCCDeclare.mod (Group): New declaration.
            Import MakeSubrange, MakeConstVar, MakeConstLit and DivTrunc.
            (FreeGroup): New declaration.
            (GlobalGroup): New declaration.
            (ToBeSolvedByQuads): Remove.
            (NilTypedArrays): Remove.
            (PartiallyDeclared): Remove.
            (HeldByAlignment): Remove.
            (FinishedAlignment): Remove.
            (ToDoList): Remove.
            (DebugSet): Re-format.
            (DebugNumber): Re-format.
            (DebugSetNumbers): Reference sets using GlobalGroup.
            (AddSymToWatch): Re-format.
            (WatchIncludeList): Reference sets using GlobalGroup.
            (WatchRemoveList): Reference sets using GlobalGroup.
            (NewGroup): New procedure.
            (DisposeGroup): New procedure.
            (InitGroup): New procedure.
            (KillGroup): New procedure.
            (DupGroup): New procedure.
            (EqualGroup): New procedure.
            (LookupSet): New procedure.
            (CanDeclareTypePartially): Reference sets using GlobalGroup.
            (CompletelyResolved): Reference sets using GlobalGroup.
            (IsNilTypedArrays): Reference sets using GlobalGroup.
            (IsFullyDeclared): Reference sets using GlobalGroup.
            (IsPartiallyDeclared): Reference sets using GlobalGroup.
            (IsPartiallyOrFullyDeclared): Reference sets using GlobalGroup.
            (DeclareTypeConstFully): Reference sets using GlobalGroup.
            (bodyl): Remove.
            (Body): Use bodyt and to lookup the required set.
            (ForeachTryDeclare): Remove parameter l.  Lookup set instead.
            (DeclareOutstandingTypes): Add new rules setarraynul and setfully.
            Reference sets using GlobalGroup.
            (ActivateWatch): New procedure.
            (DeclareTypesConstantsProceduresInRange): Re-written to check
            group change.
            (DeclareTypesConstantsProcedures): Re-written to check
            group change.
            (DeclareBoolean): Reference sets using GlobalGroup.
            (DeclarePackedBoolean): Ditto.
            (DeclareDefaultConstants): Ditto.
            (FreeGroup): Initialized.
            (GlobalGroup): Ditto.
            * gm2-compiler/Sets.def (EqualSet): New procedure function.
            Remove export qualified list of identifiers.
            * gm2-compiler/Sets.mod (EqualSet): New procedure function.

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

Reply via email to