浏览代码

Fixed loop termination

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@7914 8c9fc860-2736-0410-a75d-ab315db34111
eth.negelef 7 年之前
父节点
当前提交
9a608fcad2
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      source/FoxIntermediateBackend.Mod

+ 3 - 3
source/FoxIntermediateBackend.Mod

@@ -12007,8 +12007,8 @@ TYPE
 					IF (symbol # NIL) & (implementationVisitor.backend.cooperative) & (symbol.symbol = NIL) OR (symbol.symbol # NIL) & (symbol.type # Sections.InitCodeSection) & (symbol.type # Sections.EntryCodeSection) & (symbol.type # Sections.ExitCodeSection) & (symbol.type # Sections.InlineCodeSection) THEN
 						this := sections[s].name;
 						level := 0;
-						WHILE  (this[level] > 0) DO
-							WHILE  (this[level] > 0) & (prev[level] = this[level]) DO
+						WHILE (level < LEN(this)) & (this[level] > 0) DO
+							WHILE (level < LEN(this)) & (this[level] > 0) & (prev[level] = this[level]) DO
 								INC(level);
 							END;
 							WHILE level < olevel DO 
@@ -12023,7 +12023,7 @@ TYPE
 								scopes[olevel].gelements := scopes[olevel].gelements + scopes[olevel].elements;
 								DEC(olevel); 
 							END;
-							IF (this[level] > 0) THEN
+							IF (level < LEN(this)) & (this[level] > 0) THEN
 								IF level > olevel THEN 
 									(*TRACE("opening",level); *)
 									IF scopes[level].section = NIL THEN