https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77567

            Bug ID: 77567
           Summary: ASAN: Bugus error "alloc-dealloc-mismatch (malloc vs
                    operator delete [])" with C++17's over-aligned types
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: sanitizer
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
                CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
                    jakub at gcc dot gnu.org, jason at gcc dot gnu.org, kcc at 
gcc dot gnu.org
  Target Milestone: ---

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;
}


However, compiling with "g++ -fsanitize=address -std=c++17 test.cc" shows at
run time:

==16736==ERROR: AddressSanitizer: alloc-dealloc-mismatch (malloc vs operator
delete []) on 0x61b00001f200

Reply via email to