]> git.ipfire.org Git - thirdparty/gcc.git/commit
Avoid shift wider than unsigned HOST_WIDE_INT on unsigned integer exponentiation.
authorThomas Koenig <tkoenig@gcc.gnu.org>
Sun, 16 Feb 2025 11:15:40 +0000 (12:15 +0100)
committerThomas Koenig <tkoenig@gcc.gnu.org>
Mon, 17 Feb 2025 07:19:29 +0000 (08:19 +0100)
commitb57e6e1b38cdaf7a982474d93ebede1cc30f1d46
tree5f277fd5cf87f250d3fe81ebe571b03d133e1f74
parent46276080e726421f6683db08e2bb42fd8d3367a6
Avoid shift wider than unsigned HOST_WIDE_INT on unsigned integer exponentiation.

this patch is a variation of Jakub's patch in the PR, which
avoids overflow on the mask used for exponentiation and
fixes unsigned HOST_WIDE_INT.  I tried testing this on
a POWER machine, but --with-build-config=bootstrap-ubsan
fails bootstrap there.

gcc/fortran/ChangeLog:

PR fortran/118862
* trans-expr.cc (gfc_conv_cst_int_power): Use functions for
unsigned wide integer.
(gfc_conv_cst_uint_power): Avoid generating the mask if it would
overflow an unsigned HOST_WIDE_INT.  Format fixes.
gcc/fortran/trans-expr.cc