[llvm-bugs] [Bug 34530] New: Wrong results from floor() on arm

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Sep 8 14:36:03 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=34530

            Bug ID: 34530
           Summary: Wrong results from floor() on arm
           Product: clang
           Version: 5.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: raj.khem at gmail.com
                CC: llvm-bugs at lists.llvm.org

This testcase

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main(void)
{
   double test = 526457263.914274;
   double test2 = 526457263.000000;

   printf("orig=%f floor=%f\n", test, floor(test));
   printf("orig=%f floor=%f\n", test2, floor(test2));

   return 0;
}

runtime results on arm are wrong when -On option is not used.

root at raspberrypi3:~# ./a.out 
orig=526457263.914274 floor=526457088.000052
orig=526457263.000000 floor=0.000000

if I compile it with -Os or -O2 then results are correct

root at raspberrypi3:~# ./a.out 
orig=526457263.914274 floor=526457263.000000
orig=526457263.000000 floor=526457263.000000


This is a regression starting 4.0, it works fine with 3.7

-- 
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/20170908/101a4c24/attachment.html>


More information about the llvm-bugs mailing list