title: Why don't two binaries of programs with only comments changed exactly match in gcc?
body: <p>I created two C programs</p>
  
  <ol>
  <li><p>Program 1</p>
  
  <pre><code>int main()
  {
  }
  </code></pre></li>
  <li><p>Program 2</p>
  
  <pre><code>int main()
  {
  //Some Harmless comments
  }
  </code></pre></li>
  </ol>
  
  <p>AFAIK, when compiling, the compiler(gcc) should ignore the comments and redundant whitepaces, and hence the output must be similar.</p>
  
  <p>But when I checked the md5sums of the output binaries, they don't match. I also tried compiling with optimisation <code>-O3</code> and <code>-Ofast</code> but they still didn't match.</p>
  
  <p>What is happening here?</p>
  
  <p>EDIT:
   the exact commands and there md5sums are(t1.c is program 1 and t2.c is program 2)</p>
  
  <pre><code>gcc ./t1.c -o aaa
  gcc ./t2.c -o bbb
  98c1a86e593fd0181383662e68bac22f  aaa
  c10293cbe6031b13dc6244d01b4d2793  bbb
  
  gcc ./t2.c -Ofast -o bbb
  gcc ./t1.c -Ofast -o aaa
  2f65a6d5bc9bf1351bdd6919a766fa10  aaa
  c0bee139c47183ce62e10c3dbc13c614  bbb
  
  
  gcc ./t1.c -O3 -o aaa
  gcc ./t2.c -O3 -o bbb
  564a39d982710b0070bb9349bfc0e2cd  aaa
  ad89b15e73b26e32026fd0f1dc152cd2  bbb
  </code></pre>
  
  <p>And yes, md5sums match across multiple compilations with same flags.</p>
  
  <p>BTW my system is <code>gcc (GCC) 5.2.0</code> and <code>Linux 4.2.0-1-MANJARO #1 SMP PREEMPT x86_64 GNU/Linux</code></p>