https://bugs.llvm.org/show_bug.cgi?id=51629
Bug ID: 51629
Summary: inconsistent alignment passed for array allocation and
deallocation when alignof(cookie) > alignof(T)
Product: clang
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: C++17
Assignee: unassignedclangb...@nondot.org
Reporter: richard-l...@metafoo.co.uk
CC: blitzrak...@gmail.com, erik.pilking...@gmail.com,
llvm-bugs@lists.llvm.org, richard-l...@metafoo.co.uk
Testcase:
```
struct X { ~X(); int c; };
extern int n;
X *p = new X[n];
void f() { delete [] p; }
```
On x86_64, under `-faligned-new=2`, this passes `align_val_t{8}` to `operator
new[]` but passes `align_val_t{4}` to `operator delete[]`.
Presumably we should consistently either always or never take the array
cookie's alignment into account when synthesizing the `align_val_t` argument;
always taking it into account seems like the better choice.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs