<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/113371>113371</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[compiler-rt] The test case compiler-rt/test/builtins/Unit/atomic_test.c segfaults randomly on `__atomic_load_c()`
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
pawosm-arm
</td>
</tr>
</table>
<pre>
`__atomic_load_c()` is defined as such:
```
void __atomic_load_c(int size, void *src, void *dest,
int model) EXTERNAL_NAME(__atomic_load);
```
and is commit as such:
```
__atomic_load_c(n, data + 1, dst + 1, model);
```
...where `data` is `const` as such:
```
__attribute__((aligned(16))) static const char data[] = {
```
With the following change it stops to segfault:
```
--- a/compiler-rt/test/builtins/Unit/atomic_test.c
+++ b/compiler-rt/test/builtins/Unit/atomic_test.c
@@ -144,7 +144,7 @@ typedef uint64_t maxuint_t;
#define LEN(array) (sizeof(array) / sizeof(array[0]))
-__attribute__((aligned(16))) static const char data[] = {
+__attribute__((aligned(16))) static char data[] = {
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0lUuP6ygThn9NeVNyBOX7wotOp7M6Xy8-ndHMzsKGxIywiQzuy_z6EQ6n0-f0TGsumgj5NRC_fqiisHBOn2elWij2UBwSsfrRLu1FPFs3pWKZkt7K1xZK1nXC20kPnbFCdgNQDdRAyVA7lOqkZyVROHTrMEJ2B-wA7Nu1ZLFt3SerJX5007NHp39TQPe4_QXozi3D-65UzgPdX20wPDBZqQxQgw-_fH34_-Pdl-7x7n8PQPV3_gE02_8hzPUqZhmWMdhp0v6vreLjAuaAKoUXCLRHvvWcv3W-sf4Zym63ex7VohBKFmxibKFkg52dD90PZB-Z_KL71auu2xJUCxPSK4FqXoZ3bw2dF14PuPniMIpl475uAYTsgFB9Fq6ftR_RjwpP1hj7rOdzMJnPCrVH5-3Fobfo1PkkVuM_j2OapiiAjoOdLtqoJV080NFvmT72qzZezw7o-NOsw0gMepjfDdGQ9teG_b_zyRnkDFOe50D3VUjc2-11yr9elFQnXPXsy7zzOImXcN_5W06vexMou9YEfnl4DGlYFvEaIg9Uh01uT98PHvGH0WLPoDjEjL1zTv-LHNP-b7t-5ofshbOw49kL51EpahY1j1pELaNWt_oOP_bC6zjTRBVR-6hDVBlVRT396ESRiSITRSaKTBSZKDJRZKIb09veTWSbySZrRKJaXlFTUpGXWTK2WSbqmpdDWRZ91RBVdFKSGK8LVrMmV4luiVHOGRFvMs6yXdXLpq9yNTS8yfq8gJypSWizM-Zp2tnlnGjnVtVynmUVT4zolXHbcU00q2fcZoEonN5LGx5K-_XsIGdGO-9uNl57s53z70ukOODXUWGoAxyEU_hP6uet1B0uYpZ2Mq9oZ_zko5Gsi2lH7y8unA50BDqetR_XfjfYCegYoKOkl8X-qobw0m2pASLG4qml3wMAAP__xYnt-A">