[PATCH] have -Warray-bounds treat [max, min] ranges same as anti-ranges (PR 89720)

Martin Sebor msebor@gmail.com
Mon Mar 18 19:34:00 GMT 2019


I the -Warray-bounds enhancement committed at the beginning
of the GCC 9 window I tried to correctly handle offsets in
MEM_REFs in the [max, min] kind of a range after converting
from sizetype to ptrdiff_type, but I did it wrong.  The bug
results in false positives in some unusual use cases that
I didn't consider at the time.

The attached patch removes this incorrect handling and uses
the conservative anti-range handling for these cases instead.

Martin

PS Is there some technical reason why pointer offsets are
represented as the unsigned sizetype when they can be signed?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gcc-89720.diff
Type: text/x-patch
Size: 3188 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20190318/d41c2d39/attachment.bin>


More information about the Gcc-patches mailing list