<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><span class="vcard"><a class="email" href="mailto:t.p.northover@gmail.com" title="Tim Northover <t.p.northover@gmail.com>"> <span class="fn">Tim Northover</span></a>
</span> changed
          <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - using optimizations yields different output"
   href="https://bugs.llvm.org/show_bug.cgi?id=40402">bug 40402</a>
          <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Status</td>
           <td>NEW
           </td>
           <td>RESOLVED
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Resolution</td>
           <td>---
           </td>
           <td>INVALID
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">CC</td>
           <td>
                
           </td>
           <td>t.p.northover@gmail.com
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - using optimizations yields different output"
   href="https://bugs.llvm.org/show_bug.cgi?id=40402#c1">Comment # 1</a>
              on <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - using optimizations yields different output"
   href="https://bugs.llvm.org/show_bug.cgi?id=40402">bug 40402</a>
              from <span class="vcard"><a class="email" href="mailto:t.p.northover@gmail.com" title="Tim Northover <t.p.northover@gmail.com>"> <span class="fn">Tim Northover</span></a>
</span></b>
        <pre>C and C++ don't allow you to shift an n-bit number by exacltly n places (or
more). It's classified as "undefined behaviour" and compilers will assume it
doesn't happen when optimizing code.

The algorithm in the attached file flags up multiple cases of this when
compiled with -fsanitize=undefined, so there's a very good chance that's the
issue.

If you haven't encountered undefined behaviour before, Chris Lattner wrote a
good blog series on it, and how it affects C compilers, a few years ago:
<a href="http://blog.llvm.org/2011/05/what-every-c-programmer-should-know.html">http://blog.llvm.org/2011/05/what-every-c-programmer-should-know.html</a>.

Let us know if you can reproduce the issue after fixing t.c, but for now I'll
close this.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>