[LLVMbugs] [Bug 21409] New: wrong code from loop with FP

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Oct 29 01:16:41 PDT 2014


            Bug ID: 21409
           Summary: wrong code from loop with FP
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: regehr at cs.utah.edu
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

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 
johnregehrs-MacBook-Air:~ regehr$ clang -O fp.c ; ./a.out 
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) 
    if (d==0) 
  printf ("%d\n", c);
  return 0;
johnregehrs-MacBook-Air:~ regehr$

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20141029/dae86cf5/attachment.html>

More information about the llvm-bugs mailing list