<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/75167>75167</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
invocation of wrong function in release mode
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
zlojvavan
</td>
</tr>
</table>
<pre>
after recent refactoring and implementing new stuff in my lib discovered weird crashes in Release/RelWithDebInfo builds that were working just fine before. after some digging figured out that instead of invocation of some function the call landed to a different unrelated function in the same class. managed to at least make compiler try to retain target function body by placing asm("") in its source but disassembly output during debugging revealed that the entire function body was missing anyway and contained only lots of int3 instructions instead, then the body of that unrelated function begins.
msvc generated release build without this problem but what puzzled me even more is that gcc also suffered with the very same symptom!
I tried to overcome the problem by rearranging the class methods and further refactorings to no avail and the only workaround I was able to found was to put
#if !_MSC_VER
__attribute__((optnone))
#endif
before target function
unfortunately ATM do not have simplified reproducible testcase and wonder whether the issue is known and is there any other way to overcome the problem
Ubuntu clang version 17.0.6 (++20231208085918+6009708b4367-1~exp1~20231208090013.44)
g++ (Ubuntu 13.2.0-4ubuntu3) 13.2.0
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx0VEtvo0gQ_jX4UgqCxo7h4EMyWUs5zCX7OloFXUAnTTfqh1lymN--qiavHe1IyBZFPb76vqpC79VgiE7Z4T47POwwhtG606u2z1e8otm1Vq4n7AM5cNSRCeCoxy5Yp8wAaCSoadY0kQlsMLSAD7HvQRmYVtCqBal8Z6_kSMJCyknoHPqRPLs8kSb0lInzE-m_VRgfqH00vYU2Ki09hBEDLOQIFuteuMJz9AF6ZQha6q2jHDZ03k4EUg0DO_VqiFzPxrClUMYHQgmWgV1th0FZw28prI-mS4YwEnSoNWg0kiQECwhS9T05bj0aRxoDyc8ItQV5nAg6jd7nMKHB4S04APcXYMIXgs5Os9LkILiVvzoKyPHoBgqfK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