title: Issue preventing GCC from optimizing out global variable
body: <p>I am using ARM-GCC v4.9 (released 2015-06-23) for a STM32F105RC processor.<br>
  I've searched stackoverflow.com and I've found this in order to try to convince gcc <strong>not</strong> to optimize out a global variable, as you may see below:     </p>
  
  <pre><code>static const char AppVersion[] __attribute__((used)) = "v3.05/10.oct.2015";
  </code></pre>
  
  <p>Yet, <strong>to my real surprise</strong>, the compiler optimized away the AppVersion variable!<br>
  BTW: I am using the optimize level <em>-O0</em> (default).<br>
  I also tried using <code>volatile</code> keyword (as suggested on other thread), but it didn't work either :(<br>
  I already tried <code>(void)AppVersion;</code> but it doesn't work...<br>
  Smart compiler!? Too smart I suppose...   </p>
  
  <p>In the meantime, I use a <code>printf(AppVersion);</code> some place in my code, just to be able to keep the version... But this is a boorish solution :(<br>
  So, the question is: Is there any <em>other</em> trick that does the job, i.e. keep the version from being optimized away by GCC?</p>
  
  <p><strong>[EDIT]:</strong><br>
  I also tried like this (i.e. without <code>static</code>):  </p>
  
  <pre><code>const char AppVersion[] __attribute__((used)) = "v3.05/10.oct.2015";
  </code></pre>
  
  <p>... and it didn't work either :(</p>