From: Ilya Leoshkevich Date: Mon, 14 Mar 2022 10:42:31 +0000 (+0100) Subject: s390x/tcg: Fix BRCL with a large negative offset X-Git-Tag: qemu-xen-4.17.0-rc4~44^2~4 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=16ed5f14215b20c8dc49b96e2149032ba3238beb;p=qemu-xen.git s390x/tcg: Fix BRCL with a large negative offset When RI2 is 0x80000000, qemu enters an infinite loop instead of jumping backwards. Fix by adding a missing cast, like in in2_ri2(). Fixes: 7233f2ed1717 ("target-s390: Convert BRANCH ON CONDITION") Signed-off-by: Ilya Leoshkevich Message-Id: <20220314104232.675863-3-iii@linux.ibm.com> Reviewed-by: David Hildenbrand Reviewed-by: Richard Henderson Signed-off-by: Thomas Huth --- diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index 41c8696185..5acfc0ff9b 100644 --- a/target/s390x/tcg/translate.c +++ b/target/s390x/tcg/translate.c @@ -1201,7 +1201,7 @@ static DisasJumpType help_branch(DisasContext *s, DisasCompare *c, bool is_imm, int imm, TCGv_i64 cdest) { DisasJumpType ret; - uint64_t dest = s->base.pc_next + 2 * imm; + uint64_t dest = s->base.pc_next + (int64_t)imm * 2; TCGLabel *lab; /* Take care of the special cases first. */