<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/106933>106933</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[BUG]Why do errors occur when ASAN and UBSAN are opened together?
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
CoolCaicaixian
</td>
</tr>
</table>
<pre>
### **Env Info:**
> 【Compile Sdk Version】33
> 【NDK Version】R21e
> 【JDK】Java 8
### **Error Info:**
```
2024-08-29 09:55:10.324 18568-18568 app_process64 com.cwx.inanna_android I /Users/cwx/work/codes/gitCodes/inanna/inanna-framework/demos/android/inanna-android/app/src/main/cpp/native-lib.cpp:42:22: runtime error: member call on address 0x0041793d7bf0 which does not point to an object of type 'Base'
2024-08-29 09:55:10.324 18568-18568 app_process64 com.cwx.inanna_android I 0x0041793d7bf0: note: object is of type 'Derived'
2024-08-29 09:55:10.324 18568-18568 app_process64 com.cwx.inanna_android I 00 00 00 00 f0 95 db 13 71 00 00 00 00 00 00 00 be be be be 02 11 00 00 10 00 00 00 5b 27 00 00
2024-08-29 09:55:10.324 18568-18568 app_process64 com.cwx.inanna_android I ^~~~~~~~~~~~~~~~~~~~~~~
2024-08-29 09:55:10.324 18568-18568 app_process64 com.cwx.inanna_android I vptr for 'Derived'
```
### **C++ Code:**
```
// Base.h
class Base {
public:
virtual ~Base();
virtual int foo();
int bar();
};
// Base.cpp
Base::~Base()
{
}
int Base::foo()
{
return 1;
}
int Base::bar() {
return 2;
}
// Derived.h
class Derived : public Base {
public:
int foo() override;
};
// Derived.cpp
int Derived::foo() {
return bar() + Base::foo();
}
int init() {
Base *pBase = new Derived();
int ret = pBase->foo();
delete pBase;
return ret;
}
```
**### cmake options:**
```
target_compile_options(inanna_android PUBLIC -fsanitize=address -fno-omit-frame-pointer)
target_link_options(inanna_android PUBLIC -fsanitize=address)
target_compile_options(inanna_android PUBLIC -fsanitize=undefined -fno-sanitize-recover=undefined)
target_link_options(inanna_android PUBLIC -fsanitize=undefined -fno-sanitize-recover=undefined)
```
### **described:**
When I turned on one of the options separately, it worked well.Or if I turn off the _vptr_ check, it can work normally
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzEVk2P2zYT_jX0ZSCDImXLOvgg2-sXm7xIiwbbHBeUOFqzK5ECSdu7PeS3F5Tkr101KVIgFQiJGs7HM0POcIRz6kkjLslsRWabidj7nbHLtTH1WqhSqBcl9KQw8nVJGO8HEJYTlt_pA9zryhCe9wRCN4TmhN8BueNkQUlG16ZpVY3wWT7D72idMvq0FnM-IvBp8_Ed428sxhHWD5uPZ5YP4iBgMTD177dorTV2FO-cDqP7ZZQlEV1ELAOaEZ7PZoTnMZ1ylkC8mM0XUfcG0baPrTUlOjdP4PKUppmWx5ep0kJr8Si0tEZJuH7uAQjbPji0jrBteXwhbHs09jn8GImB-KT8epj2is6TqLKiwYFdYmMCz2DlwnQhiLYlbOtsSdi2EUoHIx1JC68OGNWqmAYCzxNGeM7CC-xee9UgYAhaIDTYFGihFHUNRoOQ0qJzQF8oTeI04zItKgrHnSp3IA060MZDa5T24A0IDab4A0sPpgL_2iIQlq6EQ8LSnxn1W7jBL208hu8AT7lrhBu06oDyJ4MESi8DKgrZDGQBMYc0vlq45irwMoAyiE-M8bWqWQEs7X9-qj83D5ndfR19_jtIh9ZbqIwd2_I3xWG8tKwJWxG2gpCx5G5LVmuSfavEELYlbAshAaa7nlTWwrmOAiRd9bR2X9SqDNWq--2gKuv3ooavffIsCMsIX71fD3lXGXPmALjwhLVC2Ku109b04NLNWeV7uKFSdMQOAM8Jz6-xDBpWF1XdJJi8CFyA3bIHDBb93mqILxDGdZwdgDFx9l78xpVhl2-DPxAhlIM-9N_fj5s4gzmgtUpiCOp3gnlCcI5n0HQ6fLdRGvXwyn-2Go3t30Qg2FFa-THdvbssb_sJ34DG4xnV-9MWdFn0HWcnExF-9x5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