aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGaius Mulley <gaiusmod2@gmail.com>2024-02-01 10:24:02 +0000
committerGaius Mulley <gaiusmod2@gmail.com>2024-02-01 10:24:02 +0000
commit75f49cf82e06971b066b4f440256004775603752 (patch)
treef66ffb30040c209220252a300d9b3b77b34cc6f5
parentb84f8a5e0a7ef3e5bd0d186fc7e280d9c43c5b7f (diff)
downloadgcc-75f49cf82e06971b066b4f440256004775603752.zip
gcc-75f49cf82e06971b066b4f440256004775603752.tar.gz
gcc-75f49cf82e06971b066b4f440256004775603752.tar.bz2
PR modula2/111627 defend against ICE
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>
-rw-r--r--gcc/m2/gm2-compiler/M2Comp.mod2
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/m2/gm2-compiler/M2Comp.mod b/gcc/m2/gm2-compiler/M2Comp.mod
index a97f0ed..c10c301 100644
--- a/gcc/m2/gm2-compiler/M2Comp.mod
+++ b/gcc/m2/gm2-compiler/M2Comp.mod
@@ -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