summaryrefslogtreecommitdiff
path: root/chapter25/src/test/java/com/seaofnodes
diff options
context:
space:
mode:
Diffstat (limited to 'chapter25/src/test/java/com/seaofnodes')
-rw-r--r--chapter25/src/test/java/com/seaofnodes/simple/Chapter25Test.java11
-rw-r--r--chapter25/src/test/java/com/seaofnodes/simple/Eval2.java3
2 files changed, 13 insertions, 1 deletions
diff --git a/chapter25/src/test/java/com/seaofnodes/simple/Chapter25Test.java b/chapter25/src/test/java/com/seaofnodes/simple/Chapter25Test.java
index a5ef67e8..f5e3d752 100644
--- a/chapter25/src/test/java/com/seaofnodes/simple/Chapter25Test.java
+++ b/chapter25/src/test/java/com/seaofnodes/simple/Chapter25Test.java
@@ -72,6 +72,17 @@ public class Chapter25Test {
assertEquals("1",Eval2.eval(code,0));
}
+ @Test
+ public void testFuzzerUnresolvedNumericLoop() {
+ CodeGen code = new CodeGen("""
+ arg=0;
+ while(arg+0)
+ while(-arg)
+ arg=0;
+ """).driver(CodeGen.Phase.TypeCheck);
+ assertEquals("return 0;",code.print());
+ }
+
@Test @Ignore
public void testModule0() throws IOException {
String MODDIR = "src/test/java/com/seaofnodes/simple/test0";
diff --git a/chapter25/src/test/java/com/seaofnodes/simple/Eval2.java b/chapter25/src/test/java/com/seaofnodes/simple/Eval2.java
index 715c499e..ea4ec326 100644
--- a/chapter25/src/test/java/com/seaofnodes/simple/Eval2.java
+++ b/chapter25/src/test/java/com/seaofnodes/simple/Eval2.java
@@ -148,7 +148,7 @@ public abstract class Eval2 {
// Evaluate until exit or timeout. Each outer loop step computes
// all data nodes under some new Control.
while( true ) {
- assert BB!=null;
+ if( BB==null ) return null;
traceCtrl(BB,trace);
if( trace!=null ) System.out.println(F.p());
@@ -177,6 +177,7 @@ public abstract class Eval2 {
case RegionNode r : break;
default: throw Utils.TODO();
}
+ if( BB==null ) return null;
assert !BB.isDead();
}
}