Hi!

This testcase started to be miscompiled with my r15-9131 change
on arm with -march=armv7-a -mfpu=vfpv4 -mfloat-abi=hard -O and got
fixed with r16-6548 PR121773 change.

Tested on armv7a-linux-gnueabi (with a cross) and x86_64-linux (-m32/-m64),
committed to trunk as obvious.

2026-03-06  Jakub Jelinek  <[email protected]>

        PR target/122000
        * gcc.c-torture/execute/pr122000.c: New test.

--- gcc/testsuite/gcc.c-torture/execute/pr122000.c.jj   2026-03-06 
14:27:02.729673052 +0100
+++ gcc/testsuite/gcc.c-torture/execute/pr122000.c      2026-03-06 
14:25:05.918636470 +0100
@@ -0,0 +1,14 @@
+/* PR target/122000 */
+
+char c = 1;
+__attribute__((aligned (sizeof (unsigned long long)))) unsigned long long ll;
+
+int
+main ()
+{
+#if defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8) && __SIZEOF_LONG_LONG__ == 8 
&& __CHAR_BIT__ == 8
+  unsigned long long x = __sync_add_and_fetch (&ll, c + 0xfedcba9876543210ULL);
+  if (x != 0xfedcba9876543211ULL)
+    __builtin_abort ();
+#endif
+}

        Jakub

Reply via email to