<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/76939>76939</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang-16 introduces a repeat function call
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Absoler
</td>
</tr>
</table>
<pre>
Hi, here's the code. From what I can tell, func_35 should only be called once, but actually it executes twice in binary ( compiled witjh clang-16 -O2 ), once inlined and once directly called.
```
const int64_t func_1() {
uint8_t *a;
int32_t b[] = {};
int16_t *c = &g_706;
*c = *c | (func_16(5, g_21, a, g_21), g_638) < b ^ g_824 % -1L;
}
int16_t func_4(int64_t, int64_t, int32_t) {}
int32_t func_16(int32_t, int64_t, uint8_t *, uint8_t d) {
int32_t *e;
if (func_32(func_35(0, g_40), e), 2 / ***g_441)
if (d)
--g_729;
++g_778;
return g;
}
int32_t func_32(uint8_t *p_33, int32_t *p_34) {
uint64_t f[4][10][6];
int g, h, i;
for (g = 0; g < 4; g++)
for (h = 0; h < 10; h++)
for (i = 0; i < 6; i++)
f[g][h][i] = 5;
if (f[2][9][0]) {
int32_t j;
if (j) {
int32_t k;
}
}
return 0;
}
uint8_t *func_35(int16_t, uint8_t *) {
int32_t l;
int16_t *m = &g_256;
g_52--;
g_63--;
int32_t *n = &l;
g_77 = n;
if (*m &= 7)
g_21 = g_140;
return &g_824;
}
```
the disassembly is:
```
0000000000001130 <func_1>:
func_1():
/root/storetest/test/output2.c:55
1130: push %rbp
1131: push %rbx
1132: push %rax
/root/storetest/test/output2.c:59
1133: movzwl 0x2f90(%rip),%ebx # 40ca <g_706>
113a: movzbl 0x2eef(%rip),%ebp # 4030 <g_21>
func_35(): # ----------------------------------------- inline, first execution ----------------------------------------
/root/storetest/test/output2.c:89
1141: decl 0x2f45(%rip) # 408c <g_52>
/root/storetest/test/output2.c:90
1147: decq 0x2f42(%rip) # 4090 <g_63>
114e: lea 0x4(%rsp),%rax
/root/storetest/test/output2.c:92
1153: mov %rax,0x2f3e(%rip) # 4098 <g_77>
/root/storetest/test/output2.c:93
115a: andw $0x7,0x2f48(%rip) # 40aa <g_256>
1162: je 1172 <func_1+0x42>
/root/storetest/test/output2.c:94
1164: movzwl 0x2f35(%rip),%eax # 40a0 <g_140>
116b: mov %ax,0x2ebe(%rip) # 4030 <g_21>
func_16():
/root/storetest/test/output2.c:64
1172: call 1270 <func_35> # ---------------------------------------- direct call, second execution ----------------------------
```
I wonder how to understand this situation
[case.zip](https://github.com/llvm/llvm-project/files/13829063/case.zip)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycV9lu6j4afxpz8wnkeMlywUVpi-ZII80jICcxiTshYWLnQM_Tj7yQBehf7YkQduxv_X2LHaG1qlopt4jvEH9bicHUXb99yXXXyH6Vd-Xn9l8KkVeoZS8RSTSYWkLRlXID-747waUWBn5BIVowsmks6XFoiwPloOtuaEro2uYTcgmFaBppXwtpqfLBgCjMIJrmE5QBeZXFYKQGc1GFBNVCrlrRfwIiKRTd6aws90WZjxqKRrTVOoph_R8CiGRWnpULqm1UK0sQrVcEpeplYZrPoH2D8BvCL-E_xuHnXouu1QZUa2J2MN6JCJEUkQxQsvM0AACDak16MIDIi0D0tqFaQ8nBQO6RBETfHFvyNtEAWLIo9syFpyFxdUhwvKCa7dpJ8mpB8BbFiKTc-lsdSGRHMb1kfhpTbzR9hRwQf4fqkBIGiHBYR_8eFVnT3ORmk1PAEEkDBlbacmo9vOEx43aOT-aNhAv2GWzz1_IB35tARF7kErvjCAMl44wjkmLvOMMBAxlGmxx7r9H-qgNjDqZR5CS2fFhfr6tDQrK7wOwQ2VWHJEkX6700Q99C9RTcCR5n9gyI84HSGbRhiT1NOZ-ViO8Y4m-I7yLsx9gOdykGlStZJ3qxd-x662zlkgsjuoPK5QlzU-_dBESgrifq2lFHfn5PPnsCp5o4leOM3fRBD-K7yntT-0Hd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