<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/119200>119200</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Clang] clang seems to compile the code wrong
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
IOVOVHS
</td>
</tr>
</table>
<pre>
``` cpp
class Container_3 {
public:
unsigned long member_7;
unsigned long member_8;
float member_9;
Container_3(unsigned long m7, unsigned long m8, float m9)
: member_7(m7), member_8(m8), member_9(m9) {}
~Container_3() {}
};
class Container_4 : public Container_3 {
public:
float member_10;
float member_11;
float member_12;
Container_4(unsigned long m7, unsigned long m8, float m9, float m10, float m11, float m12)
: Container_3(m7, m8, m9), member_10(m10), member_11(m11), member_12(m12) {}
~Container_4() {}
};
...
Container_4 var82(100, 200, 300.0f, 1.0f, 2.0f, 3.0f);
...
```
Container_4 inherits container_3 through public. However, an error occurs when executing the statement "var82.member_7 = var82.member_7 + 100;".
``` c++
(lldb) s
Process 4120 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BREAKPOINT (code=1, subcode=0x10000398c)
frame #0: 0x000000010000398c reduced_case`func_int_rand_1(p_0=100, p_1=105, p_2=0, p_3=10, p_4=100) at test_case.cpp:78:5
75
76 var82.member_7 = var82.member_7 * 2;
77
-> 78 var82.member_7 = var82.member_7 + 100;
79 }
80
81 char func_char_rand_2(char p_0,char p_1,char p_2,char *p_3)
(lldb) s
Process 4120 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BREAKPOINT (code=1, subcode=0x10000398c)
frame #0: 0x000000010000398c reduced_case`func_int_rand_1(p_0=100, p_1=105, p_2=0, p_3=10, p_4=100) at test_case.cpp:78:5
75
76 var82.member_7 = var82.member_7 * 2;
77
-> 78 var82.member_7 = var82.member_7 + 100;
79 }
80
81 char func_char_rand_2(char p_0,char p_1,char p_2,char *p_3)
```
``` bash
clang ++ --version
Homebrew clang version 19.1.4
Target: arm64-apple-darwin24.1.0
clang++ test_case.cpp -o test_case -g
./test_case
[1] 4742 trace trap ./test_case
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsVk9v47YT_TT0ZWCBHMmWdPBBjmNk8QN-WbSLRW8GRU1kFZKoklSSXvrZC1Ly3yLbbXtdQzCHj8PH4ZshJWltU_dEG7bastVuIUd31Gbz6fnr89ennxelrn7fsDWfHlDDwHihWmktPOjeyaYnc4iBpVvGi2Es20axuGC8AAAY-8BdQav7GjrqSjKHlMXbb41nl_GXVkt3wvMJn4euFmeY3RGlDB_uyTOPzYQ5wxxmIv9jcXGJDjM_P_fu54gw8_OvsdxjE0-6ZenuEtkft6HduqS78y7uRUxCGJOE36HtjTaCfyCaEB8N4AdyJv9KzrMt-HVHXHfQK3gr-q1U00ITddD2Sm_PmwX2G1QEVNyhGFD8m-wk38pOFEWTcZ2gV2kyzy142CVOTcx5xF-8JeYW5zYO7Vy4Z8bzabpjb_ojmcZZUFfJd0ejx_o410UET_qNXsl4dtkDGaMNaKVGY-HtSD3QO6nRNX0N7khgnXTUUe-AIYboo1OdA4t3cA_hFvze4i1DPEV7GzMohlv_8IJh1rZV6SW0jBefjVZkLSQCOVinh4Gq4FX4TZCsgGEcCuK3kUYK6zNMle4iOQwtRZ1s-uXkyjCUgmcBQ9LqPrg__vJw2P70WPzv8_On_38BhpnSFbF4F2jtWM5d_i445zzOM3WpuRcjO_IxcF95_J1Pv7MnGKpGRdVBSUtszV_GXh2a3h2M7KuDL7ThwP1aU9aHgwid1dRBv-xkxgGf7OQ0IQfpwJF1gT7y92hcpBmLi9UUX3pq1wCM5z7i70lYAXg-4WnKeLFk8SOk2T8iOWd9osnD5OlMQMYnNBMBVUdpIEjjrUkbfyQC7gXCh9kUFxNPJsPC6xNy8qN8fpTPfymf24v05o4qpT1Ob9i-hum-guXylYxtdM948aQ7Kg29weQxD4DIIxEljB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