On 01/01/2018 03:30 PM, Martin Sebor wrote:
> PR tree-optimization/83640 - ice in generic_overlap at
> gimple-ssa-warn-restrict.c:814 highlights out a class of cases
> where the -Wrestrict checker assumes that the range of a pointer
> offset that us represented by a VR_RANGE has a lower bound that
> is less than its upper bound.  The pass asserts that this is so
> and cases to the contrary trigger an ICE.
> 
> The submitted test case that triggers this ICE is due to a missed
> optimization in tree-ssa-strlen (which could, and IMO should,
> guarantee that the offsets it constructs are in such a range, and
> I'll submit a separate patch with that change), but the assumption
> isn't safe in general for offsets whose range happens to straddle
> the PTRDIFF_MAX boundary, i.e., whose lower bound is greater than
> its upper bound.
> 
> The attached patch makes adjustments to remove this assumption
> and avoid the ICE.  Tested on x86_64-linux with no regressions.
> 
> Martin
> 
> PS The patch also removes the same troublesome assertion that's
> also removed in the one below:
> 
>   https://gcc.gnu.org/ml/gcc-patches/2017-12/msg01399.html
> 
> gcc-83640.diff
> 
> 
> PR tree-optimization/83640 - ice in generic_overlap at 
> gimple-ssa-warn-restrict.c:814
> 
> gcc/ChangeLog:
> 
>       PR tree-optimization/83640
>       * gimple-ssa-warn-restrict.c (builtin_access::builtin_access): Avoid
>       subtracting negative offset from size.
>       (builtin_access::overlap): Adjust offset bounds of the access to fall
>       within the size of the object if possible.
>       (maybe_diag_overlap): Remove troublesome assertion.
> 
> gcc/testsuite/ChangeLog:
> 
>       PR tree-optimization/83640
>       * gcc.dg/Wrestrict-3.c: New test.
>       * gcc.dg/pr83640.c: New test.
I fixed the trivial conflict with the assertion removal and renamed the
test from Wrestrict-3.c to Wrestrict-5.c due to a conflict.

Installed onto the trunk.

Thanks,
jeff

Reply via email to