rtlanal.c
181 KB
-
Fix two ubsan failures (PR85164) · cd7f7c54
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
Richard Sandiford committed