[LLVMbugs] [Bug 13609] New: trunc() is now returning incorrect results, not even an integer
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Aug 14 19:29:54 PDT 2012
http://llvm.org/bugs/show_bug.cgi?id=13609
Bug #: 13609
Summary: trunc() is now returning incorrect results, not even
an integer
Product: new-bugs
Version: unspecified
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: new bugs
AssignedTo: unassignedbugs at nondot.org
ReportedBy: ppelletier at oblong.net
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
This seems to be a recently introduced problem, because I don't believe it
happened with the clang I built last week, but it happens with the clang I
built today.
Here is my test program:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main (int argc, char **argv)
{
printf ("compiled with: " __VERSION__ "\n");
printf ("trunc (-0.5) = %f\n", trunc (-0.5));
printf ("trunc (-3.14) = %f\n", trunc (-3.14));
printf ("trunc (-2.71) = %f\n", trunc (-2.71));
printf ("trunc (-0.1) = %f\n", trunc (-0.1));
return EXIT_SUCCESS;
}
And here is what happens when I run it with today's clang, and when I run it
with gcc:
ppelletier at chives:~/misc$ /home/ppelletier/clang/bin/clang trunc-test.c
ppelletier at chives:~/misc$ ./a.out
compiled with: 4.2.1 Compatible Clang 3.2 (trunk 161724) (llvm/trunk 161918)
trunc (-0.5) = -0.500000
trunc (-3.14) = -3.500000
trunc (-2.71) = -3.000000
trunc (-0.1) = -0.500000
ppelletier at chives:~/misc$ gcc trunc-test.c
ppelletier at chives:~/misc$ ./a.out
compiled with: 4.4.3
trunc (-0.5) = -0.000000
trunc (-3.14) = -3.000000
trunc (-2.71) = -2.000000
trunc (-0.1) = -0.000000
The gcc results are what I would expect, but the clang results seem obviously
wrong by inspection, in addition to disagreeing with the gcc results.
This is on Ubuntu 10.04, on an x86_64 machine.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list