On 11/27/2017 02:24 PM, Martin Sebor wrote:
Bug 83058 - [6/7/8 Regression] ICE on C++ code with negative array
index: in warn_placement_new_too_small, at cp/init.c:2666, reports
an ICE for an invalid placement new expression with a negative
array index.
The ICE was caused by calling tree_to_uhwi (nelts) without first
checking to make sure nelts is fits in an unsigned HOST_WIDE_INT.
While testing the code for similar boundary conditions I also found
a few other cases that the code doesn't handle entirely correctly.
To avoid the ICE the attached patch uses offset_int instead of
HOST_WIDE_INT to track offsets and sizes. It also improves
the handling of the other edge cases.
OK.
Jason