On Wed, Aug 01, 2018 at 03:07:05PM -0600, Martin Sebor wrote: > On 07/30/2018 02:08 AM, Wei Liu wrote: > > Hello, > > > > We have a program which fails to build with gcc 8.1 -m32 -O2 (version > > Debian 8.1.0-12). We couldn't figure out how the optimiser came up with > > the idea that array bounds could become negative. Any help would be > > appreciated. The attached code has been simplified from the original to > > reproduce the issue. > > It looks like a bug in the implementation of the warning. > The offset is determined not to be in the range [-205, -716] > (pointer offsets are in ptrdiff_t) or (since the variable is > unsigned) in [4294966580, 4294967091]. That means that it > can be either in the range [0, 4294966579] or in [4294967092, > UINT_MAX]. But the warning code seems to get this anti-range > wrong and treats it as [-204, -717]. > > If you have an account in GCC Bugzilla, can you please open > a bug with this test case? (If you don't let me know and I > will open one for you.) Thanks for your reply. I have created an account and opened a bug. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86827 Wei.