title: Using gcc atomic builtins?
body: <p>I'm trying to use <code>__atomic_load_n</code> from the <code>gcc</code> <a href="http://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html" rel="nofollow noreferrer">atomic builtins</a> page, compiling with</p>
  
  <pre><code>gcc -Wall -march=i686 -std=gnu99 ll.c -o ll
  </code></pre>
  
  <p>but it tells me it can't</p>
  
  <blockquote>
    <p>warning: implicit declaration of function ‘__atomic_load_n’</p>
  </blockquote>
  
  <p>I thought it would be enough to provide <code>gcc</code> with the <code>arch</code> and the <code>march</code> flags (and made sure by setting the <code>std=gnu99</code> flag), but to no avail. In fact, even if I test for the common <code>__GCC_VERSION__</code> or <code>__GNUC__</code> macros don't seem to have values... but I have a pretty vanilla <code>gcc</code> installation, the one that comes in Ubuntu.</p>
  
  <p>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</p>
  
  <p>Code looks like this: it's a function that never gets called (yet), so the problem is at compile time.</p>
  
  <pre><code>type* func(type* p) {
      type* q = __atomic_load_n (p, __ATOMIC_SEQ_CST);
  }
  </code></pre>