re PR rtl-optimization/51040 (ICE: RTL check: access of elt 1 of 'not' with last...
[gcc.git] / gcc / testsuite / gcc.dg / atomic-noinline.c
index 06a93e0058ee9eabbd54c64b663d6c873ea00182..eb0866e549ef87ff72c8df40ede47098bf7ca006 100644 (file)
@@ -49,6 +49,13 @@ main ()
   if (__atomic_is_lock_free (4, 0) != 10)
     abort ();
    
+  /* PR 51040 was caused by arithmetic code not patching up nand_fetch properly
+     when used an an external function.  Look for proper return value here.  */
+  ac = 0x3C;
+  bc = __atomic_nand_fetch (&ac, 0x0f, __ATOMIC_RELAXED);
+  if (bc != ac)
+    abort ();
+
   return 0;
 }