فهرست منبع

lower: guard failed ProcInfo/ParamInfo (no garbage-np loop)

LowerDecls emitted a proc's parameter loop even when ProcInfo failed,
using an uninitialised np -> the loop ran ~forever in FindProc (seen as
a 'hang' in the compiler session re-emit, since MaxProc is far too small
for a whole session).  Now the proc is skipped unless ProcInfo succeeds,
and each ParamInfo is guarded too.  Suite 204/204; FIXPOINT OK.
Eric Streit 1 هفته پیش
والد
کامیت
a9a8ecdf31
1فایلهای تغییر یافته به همراه20 افزوده شده و 18 حذف شده
  1. 20 18
      compiler/src/Lower.mod

+ 20 - 18
compiler/src/Lower.mod

@@ -1764,24 +1764,26 @@ PROCEDURE LowerDecls (seq: AST.Node);
         QbeGen.DeclConst(nm, qv, AST.Ty(c))
       ELSIF AST.Kind(c) = AST.NkProcDecl THEN
         Name(AST.Child(c, 0), nm);
-        IF NOT ProcInfo(nm, uid, res, depth, ext, np) THEN END;
-        QbeGen.Mangled(nm, uid, mg);
-        QbeGen.BeginFunc(mg);
-        j := 0;
-        WHILE j < np DO
-          IF NOT ParamInfo(nm, j, pt, pv, txt) THEN END;
-          IF NOT QbeGen.FuncParam(txt, pv OR SymTab.IsOpenArray(pt), pt) THEN END;
-          INC(j)
-        END;
-        QbeGen.SetFuncRes(res);
-        IF AST.Child(c, 1) = AST.NoNode THEN
-          (* declaration-only (definition module): replay the heading *)
-          QbeGen.AbortFunc
-        ELSE
-          QbeGen.EndFuncHeader;
-          LowerDecls(AST.Child(c, 2));
-          LowerStmt(AST.Child(c, 1));
-          QbeGen.EndFunc(res)
+        IF ProcInfo(nm, uid, res, depth, ext, np) THEN
+          QbeGen.Mangled(nm, uid, mg);
+          QbeGen.BeginFunc(mg);
+          j := 0;
+          WHILE j < np DO
+            IF ParamInfo(nm, j, pt, pv, txt) THEN
+              IF NOT QbeGen.FuncParam(txt, pv OR SymTab.IsOpenArray(pt), pt) THEN END
+            END;
+            INC(j)
+          END;
+          QbeGen.SetFuncRes(res);
+          IF AST.Child(c, 1) = AST.NoNode THEN
+            (* declaration-only (definition module): replay the heading *)
+            QbeGen.AbortFunc
+          ELSE
+            QbeGen.EndFuncHeader;
+            LowerDecls(AST.Child(c, 2));
+            LowerStmt(AST.Child(c, 1));
+            QbeGen.EndFunc(res)
+          END
         END
       END;
       INC(i)