From a0bd098f98cb73c7ff20acbeb1c757743621df88 Mon Sep 17 00:00:00 2001 From: ceriel Date: Tue, 2 May 1995 12:23:28 +0000 Subject: [PATCH] Fix: got into infinite loop --- lang/m2/comp/enter.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lang/m2/comp/enter.c b/lang/m2/comp/enter.c index d058fa21b..8484c6e78 100644 --- a/lang/m2/comp/enter.c +++ b/lang/m2/comp/enter.c @@ -254,7 +254,15 @@ ImportEffects(idef, scope, flag) register t_def *df = idef; register t_type *tp; - while (df->df_kind & D_IMPORTED) { + while ((df->df_kind & D_IMPORTED) && df->imp_def != df) { + /* The second condition could occur on some (erroneous and + obscure) input such as: + IMPLEMENTATION MODULE Test; + FROM X IMPORT XType, XType; + END Test. + when X does not exist. + */ + df = df->imp_def; }