Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

atomic test failed #91

Open
ghost opened this issue Feb 22, 2022 · 1 comment
Open

atomic test failed #91

ghost opened this issue Feb 22, 2022 · 1 comment

Comments

@ghost
Copy link

ghost commented Feb 22, 2022

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;
}
@ghost
Copy link
Author

ghost commented Feb 22, 2022

This bug was fixed at llvmorg-12.0.1-rc2

llvm/llvm-project@28730bc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants