https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103699
--- Comment #8 from Petr <kobalicek.petr at gmail dot com> --- My only problem is that A returns a different value compared to B, C, and D: uint32_t test_u32_a() { char array[16] {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; writeU64be(array + 6, 0xAABBCCDDEEFF1213); return readU32be(array + 7); } uint32_t test_u32_b() { static char array[16] {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; writeU64be(array + 6, 0xAABBCCDDEEFF1213); return readU32be(array + 7); } uint32_t test_u32_c() { thread_local char array[16] {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; writeU64be(array + 6, 0xAABBCCDDEEFF1213); return readU32be(array + 7); } uint32_t test_u32_d(char array[16]) { writeU64be(array + 6, 0xAABBCCDDEEFF1213); return readU32be(array + 7); } And when you compile this, you would actually see that ALL functions evaluate to a constant (because it's known what the output will be), but only in A case the constant is different (of course because B, C, D have side effects): test_u32_a(): mov eax, 117967114 ret test_u32_b(): movabs rax, 1374442237689904042 mov QWORD PTR test_u32_b()::array[rip+6], rax mov eax, -1144201746 ret test_u32_c(): movabs rax, 1374442237689904042 mov QWORD PTR fs:test_u32_c()::array@tpoff+6, rax mov eax, -1144201746 ret test_u32_d(char*): movabs rax, 1374442237689904042 mov QWORD PTR [rdi+6], rax mov eax, -1144201746 ret So yeah, we can talk about breaking strict aliasing here, but it's just inconsistent. I would just expect all functions return the same value.