diff options
author | Lulu Cheng <chenglulu@loongson.cn> | 2022-06-27 16:26:25 +0800 |
---|---|---|
committer | Lulu Cheng <chenglulu@loongson.cn> | 2022-06-29 14:43:37 +0800 |
commit | 43653547e7c8da2cd861bceb4a3e4bd338787ced (patch) | |
tree | 5ceae88828d4f0a36774914bad8785dab44cf64f /libgfortran/libgfortran.h | |
parent | b93ae1a01bbad59ee77b7c84f4743a730138ba87 (diff) | |
download | gcc-43653547e7c8da2cd861bceb4a3e4bd338787ced.zip gcc-43653547e7c8da2cd861bceb4a3e4bd338787ced.tar.gz gcc-43653547e7c8da2cd861bceb4a3e4bd338787ced.tar.bz2 |
LoongArch: Remove undefined behavior from code [PR 106097]
C++2017 and previous standard description:
The value of E1 << E2 is E1 left-shifted E2 bit positions;
vacated bits are zero-filled. If E1 has an unsigned type,
the value of the result is E1×2E2, reduced modulo one more
than the maximum value representable inthe result type.
Otherwise, if E1 has a signed type and non-negative value,
and E1×2E2 is representablein the corresponding unsigned
type of the result type, then that value, converted to the
result type, is the resulting value; otherwise, the behavior
is undefined.
The value of E1 >> E2 is E1 right-shifted E2 bit positions.
If E1 has an unsigned type or if E1 has a signed type and
a non-negative value, the value of the result is the integral
part of the quotient of E1/2E2. If E1 has a signed type and
a negative value, the resulting value is implementation-defined.
gcc/ChangeLog:
PR target/106097
* config/loongarch/loongarch.cc (loongarch_build_integer):
Remove undefined behavior from code.
Diffstat (limited to 'libgfortran/libgfortran.h')
0 files changed, 0 insertions, 0 deletions