title: Strange optimization of initialization
body: <p>I realize that my example not correct in general. But interesting to find out how it works.</p>
  
  <pre><code>/* C/C++ (gcc-4.3.4) */
  #include &lt;stdio.h&gt;
  int main() {
  
          /*volatile*/ int i = 5;
          int j = 500;
  
          int *p = &amp;j;
  
          printf( "%d %x\n", *p, p );
  
          p++;
  
          printf( "%d %x\n", *p, p  ); // works correct with volatile (*p is 5)
          //printf( "%d %x\n", *p, &amp;i  ); //  works correct without volatile
  
          return 0;
  }
  </code></pre>
  
  <p>Is it some kind of optimization?</p>
  
  <p><strong>UPDT</strong> 
  Ok i got about UB. I won't hope on another else.</p>
  
  <p>BUT if i have 2 int vars which placed adjacent to each others (see addresses) why this code shouldn't works?   </p>