title: GCC extension __attribute__ ((unused)) for variable attributes
body: <p>following is a sample code for GCC variable attribute extension,</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  int main(void){
          int sam __attribute__((unused))= 10;
          int p = sam+1;
          printf("\n%d" , p);
  }
  </code></pre>
  
  <p>for the assembly code of above program generated using:</p>
  
  <pre><code>gcc -S sample.c
  </code></pre>
  
  <p>the .s file dosen't contain the variable sam in it,whereas the output of program is "11" which is correct.
  So does the compiler neglect completely the unused variable and not output it in the executable? If so why is the output of program correct?Can anyone explain the working of unused and used variable attributes in gcc.</p>
  
  <p>Thanks</p>