]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR modula2/111627 defend against ICE
authorGaius Mulley <gaiusmod2@gmail.com>
Thu, 1 Feb 2024 10:24:02 +0000 (10:24 +0000)
committerGaius Mulley <gaiusmod2@gmail.com>
Thu, 1 Feb 2024 10:24:02 +0000 (10:24 +0000)
Although PR 111627 can be fixed by renaming testsuite modules it
highlighted that a possible ICE can occur if a malformed
implementation module is actually a program module.  This small
patch defends against this ICE and checks to see whether the module
is a DefImp before testing IsDefinitionForC.

gcc/m2/ChangeLog:

PR modula2/111627
PR modula2/112506
* gm2-compiler/M2Comp.mod (Pass0CheckMod): Test IsDefImp before
checking IsDefinitionForC.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
gcc/m2/gm2-compiler/M2Comp.mod

index a97f0edd648d78b693ee7e9fdc6656e034ddc267..c10c301cbde3c873679a874b2349311de2cc5f08 100644 (file)
@@ -869,7 +869,7 @@ BEGIN
       END
    ELSIF GenModuleList
    THEN
-      IF NOT IsDefinitionForC (sym)
+      IF IsDefImp (sym) AND (NOT IsDefinitionForC (sym))
       THEN
          (* The implementation module is only useful if -fgen-module-list= is
             used (to gather all dependencies).  Note that we do not insist