Thomas Huth 34aee9c946 host/include/generic/host/atomic128: Fix compilation problem with Clang 17
When compiling QEMU with Clang 17 on a s390x, the compilation fails:

In file included from ../accel/tcg/cputlb.c:32:
In file included from /root/qemu/include/exec/helper-proto-common.h:10:
In file included from /root/qemu/include/qemu/atomic128.h:62:
/root/qemu/host/include/generic/host/atomic128-ldst.h:68:15: error:
 __sync builtin operation MUST have natural alignment (consider using __
atomic). [-Werror,-Wsync-alignment]
   68 |     } while (!__sync_bool_compare_and_swap_16(ptr_align, old, new.i));
      |               ^
In file included from ../accel/tcg/cputlb.c:32:
In file included from /root/qemu/include/exec/helper-proto-common.h:10:
In file included from /root/qemu/include/qemu/atomic128.h:61:
/root/qemu/host/include/generic/host/atomic128-cas.h:36:11: error:
 __sync builtin operation MUST have natural alignment (consider using __a
tomic). [-Werror,-Wsync-alignment]
   36 |     r.i = __sync_val_compare_and_swap_16(ptr_align, c.i, n.i);
      |           ^
2 errors generated.

It's arguably a bug in Clang since we already use __builtin_assume_aligned()
to tell the compiler that the pointer is properly aligned. But according to
https://github.com/llvm/llvm-project/issues/69146 it seems like the Clang
folks don't see an easy fix on their side and recommend to use a type
declared with __attribute__((aligned(16))) to work around this problem.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1934
Message-ID: <20231108085954.313071-1-thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
2023-11-13 11:35:47 +01:00
..
2023-03-20 12:43:50 +01:00
2023-05-02 12:36:46 -07:00
2023-10-17 15:20:53 +02:00
2023-09-15 13:57:00 +00:00
2023-05-23 15:20:15 +08:00
2020-12-10 12:15:18 -05:00
2023-02-10 14:12:06 +01:00
2016-06-07 18:19:23 +03:00
2017-10-16 20:57:13 +03:00
2020-10-15 16:06:27 +02:00
2023-05-30 15:50:17 +01:00
2023-09-06 11:19:33 +02:00
2022-12-20 17:09:41 -08:00
2023-08-31 19:47:43 +02:00
2022-10-07 12:11:41 +02:00
2023-06-13 17:42:01 +10:00
2019-09-11 08:46:17 +02:00
2023-04-24 11:29:00 +02:00
2020-12-10 17:16:44 +01:00
2022-04-21 17:03:51 +04:00
2018-09-26 08:55:54 -07:00
2019-04-18 22:18:59 +02:00
2023-03-28 15:23:10 -07:00
2023-11-03 09:20:31 +01:00
2023-04-27 16:39:43 +02:00
2016-02-23 12:43:05 +00:00
2018-08-24 20:26:37 +02:00
2023-02-08 07:27:20 +01:00
2023-08-31 19:47:43 +02:00