https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109980
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Status|UNCONFIRMED |NEW Last reconfirmed| |2023-05-27 --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Confirmed. Note the -O2 difference just comes from inlining. So you could get away with just this for getting the warning: ``` typedef struct{ int value, decoy; } S; [[gnu::access(read_write, 1)]] int S_rw(S *self); [[gnu::access(read_only, 1)]] int S_ro(const S *self); int S_test(S *tmps){ return tmps[1].value && S_rw(tmps + 1) && S_ro(tmps + 1); } ```