You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Jump Threading optimizer is supposed to replace an unconditional jump to the function return instruction with the return instruction itself. There's a but that results in replacing conditional jump with the return instruction too. The bug only manifests in a non-inlined function that has several exit points, for example:
noinline def median(x1, x2, x3, x4, x5)
y1 = min(x1, x2);
y2 = max(x1, x2);
y4 = min(x4, x5);
y5 = max(x4, x5);
if y4 < y1 then
swap(out y1, out y4);
swap(out y2, out y5);
end;
if x3 > y2 then
y2 < y4 ? min(x3, y4) : min(y2, y5);
else
x3 > y4 ? min(x3, y5) : min(y2, y4);
end;
end;
inline def swap(in out a, in out b)
t = a; a = b; b = t;
end;
print(median(1,2,3,4,5));
This prints 2 instead of 3.
The bug probably doesn't manifest itself very often: the function needs to be non-inlined and sufficiently complex for the bug to occur.
As a workaround, setting Jump Threading to basic fixes the issue:
#set jump-threading=basic;
It might be better to keep it set until the fix is ready.
The text was updated successfully, but these errors were encountered:
Jump Threading optimizer is supposed to replace an unconditional jump to the function return instruction with the return instruction itself. There's a but that results in replacing conditional jump with the return instruction too. The bug only manifests in a non-inlined function that has several exit points, for example:
This prints
2
instead of3
.The bug probably doesn't manifest itself very often: the function needs to be non-inlined and sufficiently complex for the bug to occur.
As a workaround, setting Jump Threading to basic fixes the issue:
It might be better to keep it set until the fix is ready.
The text was updated successfully, but these errors were encountered: