public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug fortran/33561] New: Wrong code for single precision math functions on x86_64-pc-mingw32 @ 2007-09-26 11:33 fxcoudert at gcc dot gnu dot org 2007-09-26 11:45 ` [Bug fortran/33561] " fxcoudert at gcc dot gnu dot org ` (4 more replies) 0 siblings, 5 replies; 6+ messages in thread From: fxcoudert at gcc dot gnu dot org @ 2007-09-26 11:33 UTC (permalink / raw) To: gcc-bugs I have had a bug report from people who tested my gfortran binaries for mingw-w64 that the float variants of math functions aren't working properly. The proper report that was sent to me has this example: C:\gfortran\test\single_bug>type table.f90 program table real x integer i write(*,*) ' x sin(x) cos(x) tan(x)' do i = 0, 10 x = i write(*,*) x, sin(x), cos(x), tan(x) end do end program table C:\gfortran\test\single_bug>c:\gfortran\win64\bin\x86_64-pc-mingw32-gfortran table.f90 -o table C:\gfortran\test\single_bug>table x sin(x) cos(x) tan(x) 0.000000 0.000000 0.000000 0.000000 1.000000 1.000000 1.000000 1.000000 2.000000 2.0000 2.0000 2.0000 3.000000 3.0000 3.0000 3.0000 4.000000 4.0000 4.0000 4.0000 5.000000 5.0000 5.0000 5.0000 6.000000 6.0000 6.0000 6.0000 7.000000 7.0000 7.0000 7.0000 8.000000 8.0000 8.0000 8.0000 9.000000 9.0000 9.0000 9.0000 10.00000 10.0000 10.0000 10.0000 Indeed, there is a difference between a C function that calls sinf(): #include <math.h> float foo(float *x) { return sinf(*x); } which is compiled into: _foo: LFB47: pushq %rbp LCFI0: movq %rsp, %rbp LCFI1: subq $32, %rsp LCFI2: movq %rcx, 16(%rbp) movq 16(%rbp), %rax movss (%rax), %xmm0 call _sinf leave ret and the equivalent Fortran function: real function foo(x) real x foo = sin(x) end function foo that is compiled into: _foo_: LFB2: pushq %rbp LCFI0: movq %rsp, %rbp LCFI1: subq $64, %rsp LCFI2: movq %rcx, 16(%rbp) movq 16(%rbp), %rax movss (%rax), %xmm0 call _sinf movss %xmm0, -4(%rbp) movl -4(%rbp), %eax movl %eax, -20(%rbp) movss -20(%rbp), %xmm0 leave ret (Notice the extra lines between the call to _sinf and the leave.) -- Summary: Wrong code for single precision math functions on x86_64-pc-mingw32 Product: gcc Version: 4.3.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: fxcoudert at gcc dot gnu dot org GCC build triplet: i386-pc-mingw32 GCC host triplet: i386-pc-mingw32 GCC target triplet: x86_64-pc-mingw32 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33561 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/33561] Wrong code for single precision math functions on x86_64-pc-mingw32 2007-09-26 11:33 [Bug fortran/33561] New: Wrong code for single precision math functions on x86_64-pc-mingw32 fxcoudert at gcc dot gnu dot org @ 2007-09-26 11:45 ` fxcoudert at gcc dot gnu dot org 2007-09-26 12:01 ` ubizjak at gmail dot com ` (3 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: fxcoudert at gcc dot gnu dot org @ 2007-09-26 11:45 UTC (permalink / raw) To: gcc-bugs -- fxcoudert at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Last reconfirmed|0000-00-00 00:00:00 |2007-09-26 11:45:30 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33561 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/33561] Wrong code for single precision math functions on x86_64-pc-mingw32 2007-09-26 11:33 [Bug fortran/33561] New: Wrong code for single precision math functions on x86_64-pc-mingw32 fxcoudert at gcc dot gnu dot org 2007-09-26 11:45 ` [Bug fortran/33561] " fxcoudert at gcc dot gnu dot org @ 2007-09-26 12:01 ` ubizjak at gmail dot com 2007-09-26 12:03 ` rguenth at gcc dot gnu dot org ` (2 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: ubizjak at gmail dot com @ 2007-09-26 12:01 UTC (permalink / raw) To: gcc-bugs ------- Comment #1 from ubizjak at gmail dot com 2007-09-26 12:00 ------- (In reply to comment #0) > (Notice the extra lines between the call to _sinf and the leave.) -O2 will remove these lines (as well as the lines above _sinf): BTW: Could you check if _sinf returns values in %xmm0 reg? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33561 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/33561] Wrong code for single precision math functions on x86_64-pc-mingw32 2007-09-26 11:33 [Bug fortran/33561] New: Wrong code for single precision math functions on x86_64-pc-mingw32 fxcoudert at gcc dot gnu dot org 2007-09-26 11:45 ` [Bug fortran/33561] " fxcoudert at gcc dot gnu dot org 2007-09-26 12:01 ` ubizjak at gmail dot com @ 2007-09-26 12:03 ` rguenth at gcc dot gnu dot org 2007-09-26 12:52 ` ktietz at gcc dot gnu dot org 2007-09-26 14:47 ` fxcoudert at gcc dot gnu dot org 4 siblings, 0 replies; 6+ messages in thread From: rguenth at gcc dot gnu dot org @ 2007-09-26 12:03 UTC (permalink / raw) To: gcc-bugs ------- Comment #2 from rguenth at gcc dot gnu dot org 2007-09-26 12:03 ------- There is nothing wrong with the extra asm instructions. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33561 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/33561] Wrong code for single precision math functions on x86_64-pc-mingw32 2007-09-26 11:33 [Bug fortran/33561] New: Wrong code for single precision math functions on x86_64-pc-mingw32 fxcoudert at gcc dot gnu dot org ` (2 preceding siblings ...) 2007-09-26 12:03 ` rguenth at gcc dot gnu dot org @ 2007-09-26 12:52 ` ktietz at gcc dot gnu dot org 2007-09-26 14:47 ` fxcoudert at gcc dot gnu dot org 4 siblings, 0 replies; 6+ messages in thread From: ktietz at gcc dot gnu dot org @ 2007-09-26 12:52 UTC (permalink / raw) To: gcc-bugs ------- Comment #3 from ktietz at gcc dot gnu dot org 2007-09-26 12:52 ------- This doesn't seems to be an error in gcc. The w64 crt currently does not implement some math functions proper. May somebody can assist to port the assemble coded function for this target. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33561 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/33561] Wrong code for single precision math functions on x86_64-pc-mingw32 2007-09-26 11:33 [Bug fortran/33561] New: Wrong code for single precision math functions on x86_64-pc-mingw32 fxcoudert at gcc dot gnu dot org ` (3 preceding siblings ...) 2007-09-26 12:52 ` ktietz at gcc dot gnu dot org @ 2007-09-26 14:47 ` fxcoudert at gcc dot gnu dot org 4 siblings, 0 replies; 6+ messages in thread From: fxcoudert at gcc dot gnu dot org @ 2007-09-26 14:47 UTC (permalink / raw) To: gcc-bugs ------- Comment #4 from fxcoudert at gcc dot gnu dot org 2007-09-26 14:47 ------- Sorry for the wrong report, and thanks. -- fxcoudert at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |INVALID http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33561 ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-09-26 14:47 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2007-09-26 11:33 [Bug fortran/33561] New: Wrong code for single precision math functions on x86_64-pc-mingw32 fxcoudert at gcc dot gnu dot org 2007-09-26 11:45 ` [Bug fortran/33561] " fxcoudert at gcc dot gnu dot org 2007-09-26 12:01 ` ubizjak at gmail dot com 2007-09-26 12:03 ` rguenth at gcc dot gnu dot org 2007-09-26 12:52 ` ktietz at gcc dot gnu dot org 2007-09-26 14:47 ` fxcoudert at gcc dot gnu dot org
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).