title: gcc optimizations cause app to fail
body: <p>I'm having a real strange problem using GCC for ARM with the optimizations turned on. 
  Compiling my C++ application without the optimizations produces an executable that 
  at runtime outputs the expected results. As soon as I turn on the 
  optimizations - that is -O1 - my application fails to produce the expected results.
  I tried for a couple of days to spot the problem but I'm clueless.
  I eliminated any uninitialized variables from my code, I corrected the spots where 
  strict aliasing could cause problems but still I do not have the proper results.</p>
  
  <p>I'm using GCC 4.2.0 for ARM(the processor is an ARM926ej-s) and running the app 
  on a Montavista Linux distribution. </p>
  
  <p>Below are the flags I'm using:</p>
  
  <pre><code>-O1 -fno-unroll-loops fno-merge-constants -fno-omit-frame-pointer -fno-toplevel-reorder \
  -fno-defer-pop -fno-function-cse -Wuninitialized -Wstrict-aliasing=3 -Wstrict-overflow=3 \
  -fsigned-char -march=armv5te -mtune=arm926ej-s -ffast-math
  </code></pre>
  
  <p>As soon as I strip the -O1 flag and recompile/relink the application I get the proper output results. As you can see from the flags I tried to disable any optimization I thought it might cause problems but still no luck.</p>
  
  <p>Does anyone have any pointers on how I could further tackle this problem?</p>
  
  <p>Thanks</p>