[Bug c/106920] -Warray-bound false positive regression with -O2 or -Os and constant address

npfhrotynz-ptnqh.myvf at noclue dot notk.org gcc-bugzilla@gcc.gnu.org
Tue Sep 13 07:13:46 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106920

--- Comment #2 from Dominique Martinet <npfhrotynz-ptnqh.myvf at noclue dot notk.org> ---
Thanks for the very fast reply!

since you mentioned null pointers I now see this warning doesn't happen if I
try with a larger constant, I just had bad luck that imx-atf uses an address <
4k...?


I checked the first dozen of issues from the meta-bug (from start of open bugs
list to 86613 included), but there are just too many and didn't see a
workaround in the ones I did open.

I can see catching bad casts to be useful, but for low level hardware code
accessing register addresses directly is the norm -- I'm not too worried now
I've noticed the <4k "rule" but there really can't be any assumption made with
hardware, as seen here...
(And NXP isn't exactly great at working with external entities, I tried
reaching out for another compile fix with little success... but that's
offtopic.)

Well, good to understand the reason behind that warning at least.


More information about the Gcc-bugs mailing list