title: Why does clang behave weirdly with register variables compared to gcc?
body: <p><strong>Backgrounds:</strong></p>
  
  <p>I need to get the register value in the c code, so I found this in <a href="https://stackoverflow.com/questions/2114163/reading-a-register-value-into-a-c-variable">gcc usage</a>. I get the ebp value using the following code.</p>
  
  <pre><code>   register int ebp asm("ebp");
     printf("currently ebp is %08x\n", ebp);
     // then some code use the value
  </code></pre>
  
  <p>Everything seems okay until I changed my program's compiler to clang. In gcc, it usually print something similar as 0x7f1284978, definitely a pointer like value. </p>
  
  <p>But when use clang, output became weird, it print out a value like 0x9. Ebp must can't have a value like this. </p>
  
  <p><strong>Qs:</strong></p>
  
  <ul>
  <li>Does clang didn't support this register variable usage? </li>
  <li><p>Why it didn't complain warning or error if it doesn't support this feature(using the following code to compile)? </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  static size_t vfp = 0x233;
  
  int main(void) {
      register int ebp asm("ebp");
      vfp = (size_t) ebp;
      printf("vfp value is 0x%lx\n", vfp);
      return 0;
  }
  </code></pre></li>
  </ul>