https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96511
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Known to fail| |10.2.0, 11.0, 8.4.0, 9.3.0 Status|UNCONFIRMED |NEW Last reconfirmed| |2020-08-07 CC| |msebor at gcc dot gnu.org --- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> --- Confirmed. To determine the final offset the warning multiplies the offset in a POINTER_PLUS expression by the elements size the same way it does the index in an ARRAY_REF expression. The latter is correct but the former isn't. A simplified test case: $ cat pr96511.C && gcc -S -Wall -Wextra pr96511.C void* operator new (__SIZE_TYPE__, void *p) { return p; } void g () { int a[2]; new (&a[0] + 1) int; } pr96511.C: In function ‘void g()’: pr96511.C:7:14: warning: placement new constructing an object of type ‘int’ and size ‘4’ in a region of type ‘int [2]’ and size ‘0’ [-Wplacement-new=] 7 | new (&a[0] + 1) int; | ~~~~~~^~~