<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/110360>110360</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[ASAN] AddressSanitizer FN, failed to report memory leak
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
wr-web
</td>
</tr>
</table>
<pre>
reproduce: https://godbolt.org/z/WEjY9rY1G
bug code:
```cpp
#include <iostream>
void unsuspectingBug() {
int* ptr = new int(42);
// Perform some logical operations that don't affect ptr directly
for (int i = 0; i < 100; ++i) {
int temp = i * i; // Irrelevant computation
if (temp == 42) {
delete ptr;
}
}
// Forgetting to nullify ptr after deletion
// Logical usage without realizing it's been erased
if (ptr) {
std::cout << *ptr << std::endl; // Dereference of dangling pointer not realized due to logical oversight
}
}
int main() {
unsuspectingBug();
return 0;
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxsVE1v4zgM_TX0hWjhSPnywQenGS8WWAwWmMNijrJFO5qVJUOiU7S_fiAl6fQjQZBYkvn43iNFFaMZHVENmwNsjoVa-ORD_RwenqkrOq9f6kBz8HrpCWSDJ-Y5gmxAtCDa0evOW370YQTRvoJo__v262cVfq7-gvIIZdMtI_Zep9DLBmzLy7ef5-uOkMb1dtGEIJ-MjxxITSC_XY_z79kbjYuLS5ypZ-PGwzKC2IOoEHaHyzuIiMYxiAZnDgjyiI6eL1v7tQBRgTy8B00BFx34L4XBhwmjnwitH02vLPqZgmLjXUQ-KUbtHYgdoxoG6jkn0SZQz_blD-DgA4LYG8doMocS5CE_PuGqzAsQBxAH84X8VQAyTXMONZjEmEtM5vl3CGTprBxj76d54czvE8SQCNxAEk4W_zVX-miyxJS0vJlzO4Ld8Z1Pt8UX61ofRuJUE2SPbrHWDC_ZHDUwhUuGDySvgf9cbV6iGgmfDZ_8whhIWfOa0AyD2EXsiBxSUJH0uzpnjYn1PWGRdWo42fQJEeRTMh9Ec2mLvHp7hZy27ww-UqCBArme0A-olRttIjN745Ia528USaNeKGl-65czhWjGE9-z7aN_qcyTMu5eD99t8w_VCcRLcLmzPqPfrleha6krWamC6tVO7DayXK-q4lQPm35TlWKgTg-l3nd6u1WDlt16u602sqwKU4tSrMtK7FdSSlk9Ul8J3a2k2u-VVqWCdUmTMvbR2vOUrn5hYlyoXq1KuS0LqzqyMc8TIfIFTKcgRBovoU5BD90yRliX1kSOf2DYsM2DqPnRfIfNERutA8X4QznD5pUCtt9BPOGgjCWdnA80-8A40eTDC1pS_xdLsPWnIWX4tHSPvZ9AtCnZ9e9hDv4X9QyizRQjiPaq4VyL3wEAAP__q9B7YQ">