title: different type variables with same identifier linked together
body: <p><strong>a.h</strong></p>
  
  <pre><code>void addr(void);
  </code></pre>
  
  <p><strong>a.c</strong></p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int x;
  
  void addr(void) {
      printf("a:x=%p\n", &amp;x);
  }
  </code></pre>
  
  <p><strong>b.c</strong></p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include "a.h"
  
  char x;
  
  int main(void) {
      addr();                 /* a:x=0x601044 */
      printf("b:x=%p\n", &amp;x); /* b:x=0x601044 */
  
      return 0;
  }
  </code></pre>
  
  <p>Why the compiler or linker is not complaining about two extern declarations with different type and same identifier (<strong>x</strong>), and they are silently linked together?</p>
  
  <p>Environment:</p>
  
  <pre><code>$ gcc --version
  gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4
  $ gcc -o test -Wall -std=c11 a.c b.c
  </code></pre>