Hi all:
The following code snippet is for atomic function test. when using clang(https://github.com/llvm/llvm-project llvm12.0.1), this test passed. but it will failed when using classic-llvm-clang(https://github.com/flang-compiler/classic-flang-llvm-project tag flang_20211215_12x)
If we compile the code by classic-llvm-clang, this test will stucked and running forever.
clang test.c -o test./test
#include <sys/types.h>
int main(void) {
long n = 0;
if (!__sync_bool_compare_and_swap(&n, 0, 1))
return 1;
if (__sync_fetch_and_add(&n, 1) != 1)
return 1;
if (n != 2)
return 1;
__sync_synchronize();;
return 0;
}
Hi all: The following code snippet is for atomic function test. when using clang(https://github.com/llvm/llvm-project llvm12.0.1), this test passed. but it will failed when using classic-llvm-clang(https://github.com/flang-compiler/classic-flang-llvm-project tag flang_20211215_12x) If we compile the code by classic-llvm-clang, this test will stucked and running forever.
clang test.c -o test
./test