From 16f16055806c10beb2049ea7ed0cbac542724c61 Mon Sep 17 00:00:00 2001 From: Joseph Ferano Date: Fri, 11 Sep 2026 17:59:00 +0700 Subject: [PATCH] The FFI case at -O0 too, where the allocas are still there MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Every other program in the table is run twice for the reason stated next to them: at -O2 mem2reg launders a sloppy alloca, so -O0 is what tests the IR actually emitted. The raylib case had been the exception, and it is the worst one to exempt — five of its calls hand C the address of a local struct, which is exactly the alloca that comment is about. It passes as it stands. That is the point: the case that only ever ran optimised was a coincidence away from hiding something. --- test/test_acceptance.ml | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/test/test_acceptance.ml b/test/test_acceptance.ml index 7e2466e..14bb5ad 100644 --- a/test/test_acceptance.ml +++ b/test/test_acceptance.ml @@ -159,13 +159,21 @@ let () = symmetric. What the last case cannot pin, because nothing raylib computes without a GL context reads them, is width, height and mipmaps against each other. *) - if Sys.command "ldconfig -p 2>/dev/null | grep -q libraylib" = 0 then - outputs "raylib ffi, headless" "programs/raylib-ffi.flan" - "17\n34\n51\n68\n\ - 6\n1\n4\n3\n\ - 7\n13\n17\n2\n4\n3.5\n7.25\n11.5\n13.75\n\ - 1\n1\n1\n1\n7\n\ - 7\n0\n17\n2\n4\n" + let raylib_out = + "17\n34\n51\n68\n\ + 6\n1\n4\n3\n\ + 7\n13\n17\n2\n4\n3.5\n7.25\n11.5\n13.75\n\ + 1\n1\n1\n1\n7\n\ + 7\n0\n17\n2\n4\n" + in + if Sys.command "ldconfig -p 2>/dev/null | grep -q libraylib" = 0 then begin + outputs "raylib ffi, headless" "programs/raylib-ffi.flan" raylib_out; + (* And at -O0, for the reason the rest of the table is: every struct + here crosses as (addr v) on a local, which is the alloca mem2reg + would launder before anyone noticed it was wrong. *) + outputs ~opt:"-O0" "raylib ffi, headless, -O0" "programs/raylib-ffi.flan" + raylib_out + end else print_endline "acceptance: skipping the raylib FFI case (no libraylib)";