]> git.ipfire.org Git - thirdparty/gcc.git/commit
i386: Fix signed integer overflow in ix86_expand_int_movcc [PR120604]
authorUros Bizjak <ubizjak@gmail.com>
Wed, 11 Jun 2025 12:12:33 +0000 (14:12 +0200)
committerUros Bizjak <ubizjak@gmail.com>
Wed, 11 Jun 2025 14:19:57 +0000 (16:19 +0200)
commit76cbd678d123ed93f99c4c52456bc14290f19b7f
tree40d647ce4a630cbc813414776069bea21832ed5e
parent94e0f29b6b216a85a03b732a90f900b8b0e99c6b
i386: Fix signed integer overflow in ix86_expand_int_movcc [PR120604]

Patch for PR120553 enabled full 64-bit DImode immediates in
ix86_expand_int_movcc.  However, the function calculates the difference
between two immediate arguments using signed 64-bit HOST_WIDE_INT
subtractions that can cause signed integer overflow.

Avoid the overflow by casting operands of subtractions to
(unsigned HOST_WIDE_INT).

PR target/120604

gcc/ChangeLog:

* config/i386/i386-expand.cc (ix86_expand_int_movcc): Cast operands of
signed 64-bit HOST_WIDE_INT subtractions to (unsigned HOST_WIDE_INT).
gcc/config/i386/i386-expand.cc