On Wed, 15 Sept 2021 at 10:02, Fredrik Hederstierna wrote: > > I have a question about array index bounds check that I do not fully > understand.
This question belongs on the gcc-help mailing list instead. > Compiling the code below, I get warnings for out-of-bounds in one case, but > not the other, That's not what the warning says. It is warning you that the argument is null, not that item[1] is out of bounds (although it *is* out of bounds). > also printf output gets different, but should be same? Your code has undefined behaviour. There is nothing at item[1] so accessing it is undefined, and anything can happen.