[LLVMbugs] [Bug 611] "rem double x, y" always returns 0.0
bugzilla-daemon at cs.uiuc.edu
bugzilla-daemon at cs.uiuc.edu
Wed Aug 3 23:29:56 PDT 2005
http://llvm.cs.uiuc.edu/bugs/show_bug.cgi?id=611
sabre at nondot.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|REOPENED |RESOLVED
Resolution| |FIXED
------- Additional Comments From sabre at nondot.org 2005-08-04 01:29 -------
Yes, this really is fixed. After fixing your test program to be compliant, and
changing it to use strtod, it produces the expected output:
rem 7.000000, 3.000000 == 1.000000
Here's the .ll file I used, for reference:
---
%.str_1 = internal constant [4 x sbyte] c"7.0\00" ; <[4 x sbyte]*>
[#uses=1]
%.str_2 = internal constant [4 x sbyte] c"3.0\00" ; <[4 x sbyte]*>
[#uses=1]
%.str_3 = internal constant [18 x sbyte] c"rem %f, %f == %f\0A\00"
; <[18 x sbyte]*> [#uses=1]
implementation ; Functions:
declare int %printf(sbyte*, ...)
declare double %strtod(sbyte*, sbyte**)
int %main(int %argc, sbyte** %argv) {
entry:
%tmp.0 = tail call double %strtod( sbyte* getelementptr ([4 x sbyte]*
%.str_1, int 0, int 0), sbyte** null ) ; <double> [#uses=2]
%tmp.3 = tail call double %strtod( sbyte* getelementptr ([4 x sbyte]*
%.str_2, int 0, int 0), sbyte** null ) ; <double> [#uses=1]
%Y = rem double %tmp.0, %tmp.3
%tmp.6 = tail call int (sbyte*, ...)* %printf( sbyte* getelementptr ([18
x sbyte]* %.str_3, int 0, int 0), double %tmp.0, double %tmp.3, double %Y)
ret int undef
}
----
It is hard to turn this into a llvm-test program, because C/C++ don't generate
FP rem instructions. It can't be a llvm/test program, because those are not
executed. It's possible that adding it to llvm-test/LLVMSource would work (that
was the intention of that location), but I'm not sure that LLVMSource is
actually working. It appears that the llvm-test makefile doesn't descend into
it. If you'd like to investigate, feel free. :)
-Chris
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
More information about the llvm-bugs
mailing list