[Bug c++/98798] Custom operator new[] and delete[] is buggy for aligned class

2021-01-26 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98798 --- Comment #8 from Jonathan Wakely --- I've reported this as https://github.com/itanium-cxx-abi/cxx-abi/issues/119 but I haven't tried to fix the spec, or fix G++.

[Bug c++/98798] Custom operator new[] and delete[] is buggy for aligned class

2021-01-26 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98798 --- Comment #7 from Jonathan Wakely --- Also, the note in that section of the ABI is wrong: > (Note: if the usual array deallocation function takes two arguments, > then it is a member function whose second argument is of type size_t. That was

[Bug c++/98798] Custom operator new[] and delete[] is buggy for aligned class

2021-01-26 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98798 --- Comment #6 from Jonathan Wakely --- Yes, I think the ABI needs fixing. In this example Foo has a trivial destructor and Foo::operator delete[](void*, size_t, align_val_t) does not have two parameters. According to the ABI, no cookie is needed

[Bug c++/98798] Custom operator new[] and delete[] is buggy for aligned class

2021-01-26 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98798 --- Comment #5 from Jonathan Wakely --- I wonder if https://itanium-cxx-abi.github.io/cxx-abi/abi.html#array-cookies needs to be updated for aligned new[] expressions, or if G++ is just not accounring for them correctly.

[Bug c++/98798] Custom operator new[] and delete[] is buggy for aligned class

2021-01-26 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98798 --- Comment #4 from Jonathan Wakely --- #include using std::size_t; struct alignas(32) Foo { char x; void * operator new[ ] (size_t s, std::align_val_t a) { void* p = aligned_alloc(static_cast(a), s); __builtin_pr

[Bug c++/98798] Custom operator new[] and delete[] is buggy for aligned class

2021-01-26 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98798 --- Comment #3 from Jonathan Wakely --- (In reply to Martin Liška from comment #2) > I think it's a bug in libstdc++ and one can see it with valgrind: But there's no error when compiled with clang and libstdc++, so that suggests the problem is g

[Bug c++/98798] Custom operator new[] and delete[] is buggy for aligned class

2021-01-26 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98798 Martin Liška changed: What|Removed |Added CC||jwakely at redhat dot com Assig

[Bug c++/98798] Custom operator new[] and delete[] is buggy for aligned class

2021-01-25 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98798 Martin Liška changed: What|Removed |Added Last reconfirmed||2021-01-25 Status|UNCONFIRMED