瀏覽代碼

* New test for detecting faulty "LeaLea2LeaLea" optimisations

J. Gareth "Curious Kit" Moreton 5 月之前
父節點
當前提交
d9e97e3f0f
共有 1 個文件被更改,包括 22 次插入0 次删除
  1. 22 0
      tests/webtbs/tw41166.pp

+ 22 - 0
tests/webtbs/tw41166.pp

@@ -0,0 +1,22 @@
+{ %OPT=-O2 }
+program tw41166;
+
+{$mode objfpc} {$q-,r-}
+function SatSub(a, b: SizeUint): SizeUint; inline;
+begin
+  result := a - b;
+  if a < b then result := 0;
+end;
+
+var
+  r: SizeUint;
+
+begin
+  r := SatSub((random(0) + 3) * 2, 1);
+  if r <> 5 then
+  begin
+    writeln('r = ', r);
+    halt(1);
+  end;
+  writeln('ok');
+end.