This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] correct handling of offset ranges that cross PTRDIFF_MAX (PR 83640)


On Mon, Jan 1, 2018 at 11:30 PM, Martin Sebor <msebor@gmail.com> 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.

Isn't the error you are using HOST_WIDE_INT rather than offset_int
for sizrange/ovloff/ovlsiz in builtin_access?

> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]