aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2019-04-18 12:29:56 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2019-04-18 12:29:56 +0000
commitcd7f7c54a43c435152b2ac76b6e74ae6a3430472 (patch)
treed7ec130591e850d27f196e742e40bfba9f1d7602 /gcc/fold-const.c
parente62817edaecb4c8cb5a4f3c608f0ea52276449a1 (diff)
downloadgcc-cd7f7c54a43c435152b2ac76b6e74ae6a3430472.zip
gcc-cd7f7c54a43c435152b2ac76b6e74ae6a3430472.tar.gz
gcc-cd7f7c54a43c435152b2ac76b6e74ae6a3430472.tar.bz2
Fix two ubsan failures (PR85164)
Two fixes for UB when handling very large offsets. The calculation in force_int_to_mode would have been correct if signed integers used modulo arithmetic, so just switch to unsigned types. The calculation in rtx_addr_can_trap_p_1 didn't handle overflow properly, so switch to known_subrange_p instead (which is supposed to handle all cases). 2019-04-18 Richard Sandiford <richard.sandiford@arm.com> gcc/ PR middle-end/85164 * combine.c (force_int_to_mode): Cast the argument rather than the result of known_alignment. * rtlanal.c (rtx_addr_can_trap_p_1): Use known_subrange_p. gcc/testsuite/ PR middle-end/85164 * gcc.dg/pr85164-1.c, gcc.dg/pr85164-2.c: New tests. From-SVN: r270442
Diffstat (limited to 'gcc/fold-const.c')
0 files changed, 0 insertions, 0 deletions