[clang] [Clang] Fix miscompile with custom operator delete (PR #190017)

via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 1 11:46:09 PDT 2026


github-actions[bot] wrote:

<!--PREMERGE ADVISOR COMMENT: Linux-->
# :penguin: Linux x64 Test Results

* 87215 tests passed
* 1362 tests skipped
* 2 tests failed

## Failed Tests
(click on a test name to see its output)

### Clang
<details>
<summary>Clang.CodeGenCXX/microsoft-vector-deleting-dtors2.cpp</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/23/include -nostdsysteminc -emit-llvm -fms-extensions -fms-compatibility -fno-dllexport-inlines /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGenCXX/microsoft-vector-deleting-dtors2.cpp -triple=x86_64-pc-windows-msvc -o - | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck --check-prefixes=X64,CHECK /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGenCXX/microsoft-vector-deleting-dtors2.cpp
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/23/include -nostdsysteminc -emit-llvm -fms-extensions -fms-compatibility -fno-dllexport-inlines /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGenCXX/microsoft-vector-deleting-dtors2.cpp -triple=x86_64-pc-windows-msvc -o -
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGenCXX/microsoft-vector-deleting-dtors2.cpp:45:7: warning: type aware allocators are a Clang extension [-Wext-cxx-type-aware-allocators]
# |    45 | void *operator new(std::type_identity<Test>, size_t, std::align_val_t) throw();
# |       |       ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGenCXX/microsoft-vector-deleting-dtors2.cpp:46:6: warning: type aware allocators are a Clang extension [-Wext-cxx-type-aware-allocators]
# |    46 | void operator delete(std::type_identity<Test>, void*, size_t, std::align_val_t) = delete;
# |       |      ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGenCXX/microsoft-vector-deleting-dtors2.cpp:47:7: warning: type aware allocators are a Clang extension [-Wext-cxx-type-aware-allocators]
# |    47 | void *operator new[](std::type_identity<Test>, size_t, std::align_val_t) throw();
# |       |       ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGenCXX/microsoft-vector-deleting-dtors2.cpp:48:6: warning: type aware allocators are a Clang extension [-Wext-cxx-type-aware-allocators]
# |    48 | void operator delete[](std::type_identity<Test>, void*, size_t, std::align_val_t) = delete;
# |       |      ^
# | 4 warnings generated.
# `-----------------------------
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck --check-prefixes=X64,CHECK /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGenCXX/microsoft-vector-deleting-dtors2.cpp
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGenCXX/microsoft-vector-deleting-dtors2.cpp:98:9: error: X64: expected string not found in input
# | // X64: define linkonce_odr dso_local noundef ptr @"??_GNoExport@@UEAAPEAXI at Z"(ptr noundef nonnull align 8 dead_on_return(8) dereferenceable(8) %this, i32 noundef %should_call_delete)
# |         ^
# | <stdin>:357:99: note: scanning from here
# | define linkonce_odr dso_local void @"??_V?$RefCounted at UDrawingBuffer@@@@SAXPEAX at Z"(ptr noundef %p) #1 comdat align 2 {
# |                                                                                                   ^
# | <stdin>:365:1: note: possible intended match here
# | define linkonce_odr dso_local noundef ptr @"??_GNoExport@@UEAAPEAXI at Z"(ptr noundef nonnull align 8 dereferenceable(8) %this, i32 noundef %should_call_delete) unnamed_addr #1 comdat align 2 {
# | ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGenCXX/microsoft-vector-deleting-dtors2.cpp
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |             .
# |             .
# |             .
# |           352:  
# |           353: ; Function Attrs: nounwind 
# |           354: declare dso_local void @"??3Test@@SAXPEAX at Z"(ptr noundef) #2 
# |           355:  
# |           356: ; Function Attrs: mustprogress noinline nounwind optnone 
# |           357: define linkonce_odr dso_local void @"??_V?$RefCounted at UDrawingBuffer@@@@SAXPEAX at Z"(ptr noundef %p) #1 comdat align 2 { 
# | check:98'0                                                                                                       X~~~~~~~~~~~~~~~~~~~~ error: no match found
# |           358: entry: 
# | check:98'0     ~~~~~~~
# |           359:  %p.addr = alloca ptr, align 8 
# | check:98'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           360:  store ptr %p, ptr %p.addr, align 8 
# | check:98'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           361:  ret void 
# | check:98'0     ~~~~~~~~~~
# |           362: } 
# | check:98'0     ~~
# |           363:  
# | check:98'0     ~
# |           364: ; Function Attrs: mustprogress noinline nounwind optnone 
# | check:98'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           365: define linkonce_odr dso_local noundef ptr @"??_GNoExport@@UEAAPEAXI at Z"(ptr noundef nonnull align 8 dereferenceable(8) %this, i32 noundef %should_call_delete) unnamed_addr #1 comdat align 2 { 
# | check:98'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | check:98'1     ?                                                                                                                                                                                               possible intended match
# |           366: entry: 
# | check:98'0     ~~~~~~~
# |           367:  %retval = alloca ptr, align 8 
# | check:98'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           368:  %should_call_delete.addr = alloca i32, align 4 
# | check:98'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           369:  %this.addr = alloca ptr, align 8 
# | check:98'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           370:  store i32 %should_call_delete, ptr %should_call_delete.addr, align 4 
# | check:98'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             .
# |             .
# |             .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>
<details>
<summary>Clang.CodeGenCXX/ptrauth-apple-kext-indirect-virtual-dtor-call.cpp</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/23/include -nostdsysteminc -triple arm64-apple-ios -std=c++98 -fptrauth-calls -fapple-kext -fno-rtti -disable-O0-optnone -emit-llvm -o - /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGenCXX/ptrauth-apple-kext-indirect-virtual-dtor-call.cpp | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGenCXX/ptrauth-apple-kext-indirect-virtual-dtor-call.cpp
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang -cc1 -internal-isystem /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/23/include -nostdsysteminc -triple arm64-apple-ios -std=c++98 -fptrauth-calls -fapple-kext -fno-rtti -disable-O0-optnone -emit-llvm -o - /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGenCXX/ptrauth-apple-kext-indirect-virtual-dtor-call.cpp
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGenCXX/ptrauth-apple-kext-indirect-virtual-dtor-call.cpp
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGenCXX/ptrauth-apple-kext-indirect-virtual-dtor-call.cpp:48:11: error: CHECK: expected string not found in input
# | // CHECK: declare void @_ZN5TemplIiED0Ev(ptr noundef nonnull align 8 dead_on_return(8) dereferenceable(8))
# |           ^
# | <stdin>:67:80: note: scanning from here
# |  %1 = load ptr, ptr getelementptr inbounds nuw (i8, ptr @_ZTV5TemplIiE, i64 16), align 8
# |                                                                                ^
# | <stdin>:73:9: note: possible intended match here
# | declare noundef ptr @_ZN5TemplIiED1Ev(ptr noundef nonnull align 8 dead_on_return(8) dereferenceable(8)) unnamed_addr #4
# |         ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/clang/test/CodeGenCXX/ptrauth-apple-kext-indirect-virtual-dtor-call.cpp
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |             .
# |             .
# |             .
# |            62: define void @_Z1fP8SubTemplIiE(ptr noundef %t) #1 { 
# |            63: entry: 
# |            64:  %t.addr = alloca ptr, align 8 
# |            65:  store ptr %t, ptr %t.addr, align 8 
# |            66:  %0 = load ptr, ptr %t.addr, align 8 
# |            67:  %1 = load ptr, ptr getelementptr inbounds nuw (i8, ptr @_ZTV5TemplIiE, i64 16), align 8 
# | check:48'0                                                                                    X~~~~~~~~~ error: no match found
# |            68:  %2 = call i64 @llvm.ptrauth.blend(i64 ptrtoint (ptr getelementptr inbounds nuw (i8, ptr @_ZTV5TemplIiE, i64 16) to i64), i64 57986) 
# | check:48'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            69:  %call = call noundef ptr %1(ptr noundef nonnull align 8 dead_on_return(8) dereferenceable(8) %0) [ "ptrauth"(i32 0, i64 %2) ] 
# | check:48'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            70:  ret void 
# | check:48'0     ~~~~~~~~~~
# |            71: } 
# | check:48'0     ~~
# |            72:  
# | check:48'0     ~
# |            73: declare noundef ptr @_ZN5TemplIiED1Ev(ptr noundef nonnull align 8 dead_on_return(8) dereferenceable(8)) unnamed_addr #4 
# | check:48'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | check:48'1             ?                                                                                                                possible intended match
# |            74:  
# | check:48'0     ~
# |            75: declare void @_ZN5TemplIiED0Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #4 
# | check:48'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            76:  
# | check:48'0     ~
# |            77: ; Function Attrs: noinline nounwind 
# | check:48'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            78: define internal void @_ZN5TemplIiE1fEv(ptr noundef nonnull align 8 dereferenceable(8) %this) unnamed_addr #1 { 
# | check:48'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             .
# |             .
# |             .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label.

https://github.com/llvm/llvm-project/pull/190017


More information about the cfe-commits mailing list