I'm trying to use __atomic_load_n from the gcc atomic builtins page, compiling with
gcc -Wall -march=i686 -std=gnu99 ll.c -o ll
but it tells me it can't
warning: implicit declaration of function ‘__atomic_load_n’
I thought it would be enough to provide gcc with the arch and the march flags (and made sure by setting the std=gnu99 flag), but to no avail. In fact, even if I test for the common __GCC_VERSION__ or __GNUC__ macros don't seem to have values... but I have a pretty vanilla gcc installation, the one that comes in Ubuntu.
I know I'm doing something silly, but I can't figure out what. I have gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
Code looks like this: it's a function that never gets called (yet), so the problem is at compile time.
type* func(type* p) {
type* q = __atomic_load_n (p, __ATOMIC_SEQ_CST);
}
typetoint. If you suspect a problem with your compiler installation, perhaps try to build a non-trival but clean project with it to see what happens?__atomic_*functions were added in 4.7. Previous versions have__sync_*functions which fulfill a similar purpose.