title: Inconsistent results with < and <= in C with max and min ints
body: <p>I'm writing some C code to look at the bit representations of integers. 
  In the process I found code that returns different results based on optimization settings.  Am I just doing something wrong, or is this a compiler bug?</p>
  
  <p>Here is the code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int test(int x, int n)
  {
    int TMin_n = -(1 &lt;&lt; (n-1));
    int TMax_n = (1 &lt;&lt; (n-1)) - 1;
    return x &gt;= TMin_n &amp;&amp; x &lt;= TMax_n;
  }
  
  int main(){
  
      int x = 0x80000000;
      int n = 0x20;
      if(test(x,n)){
          printf("passes\n");
      }
      else{
          printf("fails\n");
      }
  }
  </code></pre>
  
  <p>If I compile it this way I get a passing result</p>
  
  <pre><code>$ gcc tester.c -o tester
  $ ./tester
  passes
  </code></pre>
  
  <p>If I compile it this way I get a failing result</p>
  
  <pre><code>$ gcc -O1 tester.c -o tester
  $ ./tester
  fails
  </code></pre>
  
  <p>The problem is that</p>
  
  <pre><code>x &lt;= TMax_n
  </code></pre>
  
  <p>is evaluating as false in the optimized case only.</p>
  
  <p>Here is my platform details:</p>
  
  <pre><code>$ gcc --version
  Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
  Apple LLVM version 8.0.0 (clang-800.0.42.1)
  Target: x86_64-apple-darwin16.4.0
  Thread model: posix
  InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
  </code></pre>