-
Notifications
You must be signed in to change notification settings - Fork 13.3k
[MS][clang] Make sure vector deleting dtor calls correct operator delete #133950
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
During additional testing I spotted that vector deleting dtor calls operator delete, not operator delete[] when performing array deletion. This patch fixes that.
✅ With the latest revision this PR passed the C/C++ code formatter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks good to me!
We're seeing several errors building chromium that bisect to this change:
I'm working on putting together a minimal repro. |
Yes, I've reproduced it locally with current trunk clang. |
This is the smallest reproduction I could find:
When run with
|
Looking... Does not reproduce without c++20. |
And issue was reported in llvm#133950 . Since we don't always emit vector deleting dtors, only error out about ambigous operator delete[] when it will be required for vector delering dtor emission.
I posted a PR with a potential fix. |
#135041) And issue was reported in #133950 (comment) . Since we don't always emit vector deleting dtors, only error out about ambiguous operator delete[] when it will be required for vector deleting dtor emission.
…hen required (#135041) And issue was reported in llvm/llvm-project#133950 (comment) . Since we don't always emit vector deleting dtors, only error out about ambiguous operator delete[] when it will be required for vector deleting dtor emission.
Thanks! Unfortunately it looks like the fix introduced a regression of #134265 on Windows. Repro:
Running
|
Yeah, but this is kind of expected. Otherwise it is unclear how to emit vector deleting destructor body. Should we fallback to calling something, like MSVC does? See #135041 (comment) for example. |
I'm not familiar enough to say what we should be doing; perhaps @rnk or @zmodem have thoughts? It seems like we should at least emit a better error message, since just looking at the code doesn't make it clear to me why Since this is causing clang to become more restrictive, the best thing to do might be to revert to whatever we used to do in this situation, and then make a followup change which specifically explains why clang is becoming more restrictive. |
(For reference, this is https://crbug.com/410000261 on our side.) The "deleted operator delete[]" is coming from here: https://source.chromium.org/chromium/chromium/src/+/main:v8/include/cppgc/garbage-collected.h;l=61 Rejecting the code seems wrong, since that's only happening due to this extension. I'm not sure what the best option is here, but I think we should look closer at what exactly MSVC is emitting. |
I'm working on a revert of the extension. |
…ator delete (llvm#133950)" This reverts commit 8a691cc.
Finding operator delete[] is still problematic, without it the extension is a security hazard, so reverting until the problem with operator delete[] is figured out. This reverts the following PRs: Reland [MS][clang] Add support for vector deleting destructors (#133451) [MS][clang] Make sure vector deleting dtor calls correct operator delete (#133950) [MS][clang] Fix crash on deletion of array of pointers (#134088) [clang] Do not diagnose unused deleted operator delete[] (#134357) [MS][clang] Error about ambiguous operator delete[] only when required (#135041)
llvm#135041) And issue was reported in llvm#133950 (comment) . Since we don't always emit vector deleting dtors, only error out about ambiguous operator delete[] when it will be required for vector deleting dtor emission.
Finding operator delete[] is still problematic, without it the extension is a security hazard, so reverting until the problem with operator delete[] is figured out. This reverts the following PRs: Reland [MS][clang] Add support for vector deleting destructors (llvm#133451) [MS][clang] Make sure vector deleting dtor calls correct operator delete (llvm#133950) [MS][clang] Fix crash on deletion of array of pointers (llvm#134088) [clang] Do not diagnose unused deleted operator delete[] (llvm#134357) [MS][clang] Error about ambiguous operator delete[] only when required (llvm#135041)
During additional testing I spotted that vector deleting dtor calls operator delete, not operator delete[] when performing array deletion. This patch fixes that.