[LLVMdev] Is it correct to access non-atomic variables using atomic operations?
Lei Zhao
leizhao833 at gmail.com
Fri Aug 3 15:11:10 PDT 2012
Hi Everyone,
This might be more a C/C++11 question than a LLVM question: I wondering if it is semantically correct to access an ordinary variable via atomic operations, like:
int val;
void foo(){ atomic_store((atomic_int *)(&val), 42); }
I tried this simple program on clang+llvm and 42 seems to be correctly stored to val. But, is this just by luck or a right way to go?
Thanks.
- Lei
More information about the llvm-dev
mailing list