From 8bbc33baa40010c8f5ca1af9b8bfffd67ae654ad Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Thu, 25 Jan 2018 08:49:33 +0000 Subject: gcc-7.3.0 --- gcc/testsuite/gcc.dg/atomic/stdatomic-load-4.c | 44 ++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/atomic/stdatomic-load-4.c (limited to 'gcc/testsuite/gcc.dg/atomic/stdatomic-load-4.c') diff --git a/gcc/testsuite/gcc.dg/atomic/stdatomic-load-4.c b/gcc/testsuite/gcc.dg/atomic/stdatomic-load-4.c new file mode 100644 index 0000000000..bc26a5238d --- /dev/null +++ b/gcc/testsuite/gcc.dg/atomic/stdatomic-load-4.c @@ -0,0 +1,44 @@ +/* Test atomic_load routines for existence and proper execution on + 8-byte values with each valid memory model. */ +/* { dg-do run } */ +/* { dg-options "-std=c11 -pedantic-errors" } */ + +#include + +extern void abort (void); + +_Atomic long long v; +long long count; + +int +main () +{ + v = 0; + count = 0; + + if (atomic_load_explicit (&v, memory_order_relaxed) != count++) + abort (); + else + v++; + + if (atomic_load_explicit (&v, memory_order_acquire) != count++) + abort (); + else + v++; + + if (atomic_load_explicit (&v, memory_order_consume) != count++) + abort (); + else + v++; + + if (atomic_load_explicit (&v, memory_order_seq_cst) != count++) + abort (); + else + v++; + + if (atomic_load (&v) != count) + abort (); + + return 0; +} + -- cgit v1.2.1