https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97261
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |msebor at gcc dot gnu.org --- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- const ab_t* ab = (ab_t*)(pb - 1); note that this invokes undefined behavior as you are producing the address of one-before the start of an object. You are also violating strict aliasing rules with the access in g() which accesses a ab_t object but there's only a double where you point to (well, there's nothing actually). While the particular warning isn't very useful: tst.c:21:17: warning: array subscript -1 is outside array bounds of 'double[1]' [-Warray-bounds] 21 | const ab_t* ab = (ab_t*)(pb - 1); | ^~ it does point to the offending statement. It probably should read 'warning: computing the address one element before the object 'double' invokes undefined behavior' or so. Mentioning double[1] when there's just a 'double' is likely also more confusing than it helps. Maybe spelling out 'non-array object X' would be better here. All in all the bug for the testcase is invalid but I'm leaving it open to eventually improve the actual diagnostic message.