https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109298
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Component|c |tree-optimization Ever confirmed|0 |1 Keywords| |diagnostic Status|UNCONFIRMED |NEW Blocks| |56456 Last reconfirmed| |2023-03-28 --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- Confirmed. <bb 2> [local count: 1073741824]: packet_4 = __builtin_malloc (40); _1 = &packet_4->data; __builtin_memcpy (_1, buf_5(D), 36); _7 = MEM[(struct ib_rmpp_mad *)packet_4 + 4B].class; return _7; the issue is that rmpp_mad->class is considered a dereference of rmpp_mad where ib_rmpp_mad doesn't fit in the allocation. The wording of the diagnostic is just very confusing here. How the fix to the driver should look like probably depends on the actual source - for the reduced testcase the allocation/copying doesn't make sense while for the actual driver it probably does. As said above, the diagnostic wording could be improved, so confirmed. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56456 [Bug 56456] [meta-bug] bogus/missing -Warray-bounds