https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61293
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jason at gcc dot gnu.org --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- IMNSHO you can't change the value of extra, that is an ABI issue, and -fsanitize=address shouldn't be an ABI changing option. Consider: struct S { S (); ~S (); }; S *foo (int n) { return new S[n]; } void bar (S *p) { delete [] p; } int main () { bar (foo (5)); } where bar is defined in a different compilation unit/library and something is built with -fsanitize=address, something is not. If the padding before structure is at least 64-bit, sure, instrumenting the FE to put there an __asan_poison_memory_region call after the size is stored there and in delete[] again to __asan_unpoison_memory_region before reading the size should not be that hard. For 32-bit code if the type doesn't need at least 64-bit alignment (again, alignment of the type is an ABI thing), you are out of luck I'm afraid. Thus, e.g. tests for this will need to be conditionalized.