[Bug sanitizer/77567] ASAN: Bugus error "alloc-dealloc-mismatch (malloc vs operator delete [])" with C++17's over-aligned types
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Sep 13 16:56:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77567
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2016-09-13
Ever confirmed|0 |1
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Tobias Burnus from comment #0)
> In my understanding, the following is valid C++17:
>
> #include <new>
>
> int main() {
> char *c = new(std::align_val_t(512), std::nothrow) char[1024];
> delete[] c;
> return 0;
> }
According to Jason, this is not valid C++17, because it violates
[new.delete.array]/13:
"Requires: If the alignment parameter is not present, ptr shall have been
returned by an allocation function without an alignment parameter. If present,
the alignment argument shall equal the alignment argument passed to the
allocation function that returned ptr."
That said, we want to instrument it in libsanitizer, let me attach 2 patches
for discussions.
More information about the Gcc-bugs
mailing list