]> git.ipfire.org Git - thirdparty/valgrind.git/commit
s390: Bug fix in insn selection master
authorFlorian Krohm <flo2030@eich-krohm.de>
Tue, 14 Apr 2026 21:36:18 +0000 (21:36 +0000)
committerFlorian Krohm <flo2030@eich-krohm.de>
Tue, 14 Apr 2026 21:36:18 +0000 (21:36 +0000)
commita16e818e63ff41abba7c17aa5fd75f120e9700df
treedf4b4b214fec40056b8315a1ee5448d13ca683f8
parentac42a29a8eb076f1bba25ae9d4d355e0872c2f6b
s390: Bug fix in insn selection

The bug was introduced in b3830b82f4 and exposed by GCC when compiling
with -g (without -O2). Here's the thing:

      if (expr->Iex.Binop.op == Iop_Add64) {
--->     ULong disp = arg2->Iex.Const.con->Ico.U64;
         if (arg2->tag == Iex_Const && ulong_fits_signed_20bit(disp)) {
            h1 = s390_isel_int_expr(env, arg1);

This possibly segfaults when arg2 is not a constant.
Optimising GCC figures it can first check arg2->tag == Iex_Const
which is cheaper than disp = arg2->Iex.Const.con->Ico.U64;
Nice one.

Regtested with both default compiler flags and -g only.
VEX/priv/host_s390_isel.c