From 3d226b49e1cd23b41fd9baf3917f751973c1ad11 Mon Sep 17 00:00:00 2001 From: Cliff Click Date: Sun, 27 Sep 2026 09:09:23 -0700 Subject: minor fixes Fix CI build Backport ch 23 fix to ch 22. --- chapter22/src/test/java/com/seaofnodes/simple/Chapter09Test.java | 4 ++-- chapter22/src/test/java/com/seaofnodes/simple/Chapter20Test.java | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'chapter22/src/test') diff --git a/chapter22/src/test/java/com/seaofnodes/simple/Chapter09Test.java b/chapter22/src/test/java/com/seaofnodes/simple/Chapter09Test.java index d4d02aa9..551880b1 100644 --- a/chapter22/src/test/java/com/seaofnodes/simple/Chapter09Test.java +++ b/chapter22/src/test/java/com/seaofnodes/simple/Chapter09Test.java @@ -128,7 +128,7 @@ while(v1+arg) { } """); code.parse().opto(); - assertEquals("return Top;", code.print()); + assertEquals("Stop[ ]", code.print()); // No explicit return: omit default main. } @Test @@ -210,7 +210,7 @@ return -0+0+0; public void testFuzz3() { CodeGen code = new CodeGen("int v0=0; while(0==69) while(v0) return 0;"); code.parse().opto(); - assertEquals("return 0;", code.print()); + assertEquals("Stop[ ]", code.print()); // The only return is unreachable. } @Test diff --git a/chapter22/src/test/java/com/seaofnodes/simple/Chapter20Test.java b/chapter22/src/test/java/com/seaofnodes/simple/Chapter20Test.java index 1765512a..1f4a3d27 100644 --- a/chapter22/src/test/java/com/seaofnodes/simple/Chapter20Test.java +++ b/chapter22/src/test/java/com/seaofnodes/simple/Chapter20Test.java @@ -205,6 +205,11 @@ s.cs[0] = 67; // C s.cs[1] = 108; // l hashCode(s); """; + // Without an explicit return, default main must be removed completely. + // Seed 0 previously left a loop with a missing branch successor. + for( String cpu : new String[]{"x86_64_v2","riscv","arm"} ) + new CodeGen(src,com.seaofnodes.simple.type.TypeInteger.BOT,0) + .driver(CodeGen.Phase.Encoding,cpu,"SystemV"); testTarget(src,"x86_64_v2", "SystemV",0,null); testTarget(src,"riscv" , "SystemV",0,null); testTarget(src,"arm" , "SystemV",0,null); -- cgit v1.2.3