<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - wrong code from loop with FP"
   href="http://llvm.org/bugs/show_bug.cgi?id=21409">21409</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>wrong code from loop with FP
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>regehr@cs.utah.edu
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The following program counts the number of floats between 0.56 and 0.57.  I
believe it is conforming.

johnregehrs-MacBook-Air:~ regehr$ clang -v
clang version 3.6.0 (trunk 220780)
Target: x86_64-apple-darwin14.0.0
Thread model: posix
johnregehrs-MacBook-Air:~ regehr$ clang fp.c ; ./a.out 
167773
johnregehrs-MacBook-Air:~ regehr$ clang -O fp.c ; ./a.out 
0
johnregehrs-MacBook-Air:~ regehr$ cat fp.c
#include <assert.h>
#include <string.h>
#include <stdio.h>

int main (void) {
  unsigned d=0;
  int c=0;
  while (1) {
    float f;
    memcpy(&f, &d, 4);
    if (f>=0.56 && f<=0.57) 
      c++;
    d++;
    if (d==0) 
      break;
  }
  printf ("%d\n", c);
  return 0;
}
johnregehrs-MacBook-Air:~ regehr$</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>