diff options
author | Jakub Jelinek <jakub@redhat.com> | 2024-01-25 13:15:23 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2024-01-25 13:15:23 +0100 |
commit | fb1b7e2fec951ba0bf4f68fac6a16929f4f63910 (patch) | |
tree | afaed299df64594243193e3ad76f5c0ccc665544 /gcc/fold-const.cc | |
parent | c3de14ba1ba0e77254118af64ed881f115ee42a0 (diff) | |
download | gcc-fb1b7e2fec951ba0bf4f68fac6a16929f4f63910.zip gcc-fb1b7e2fec951ba0bf4f68fac6a16929f4f63910.tar.gz gcc-fb1b7e2fec951ba0bf4f68fac6a16929f4f63910.tar.bz2 |
convert: Fix test for out of bounds shift count [PR113574]
The following patch is miscompiled, because convert_to_integer_1 for
LSHIFT_EXPR tests if the INTEGER_CST shift count is too high, but
incorrectly compares it against TYPE_SIZE rather than TYPE_PRECISION.
The type in question is unsigned _BitInt(1), which has TYPE_PRECISION 1,
TYPE_SIZE 8, and the shift count is 2 in that case.
2024-01-25 Jakub Jelinek <jakub@redhat.com>
PR middle-end/113574
* convert.cc (convert_to_integer_1) <case LSHIFT_EXPR>: Compare shift
count against TYPE_PRECISION rather than TYPE_SIZE.
* gcc.dg/torture/bitint-52.c: New test.
Diffstat (limited to 'gcc/fold-const.cc')
0 files changed, 0 insertions, 0 deletions