http://bugs.winehq.org/show_bug.cgi?id=31330
Bug #: 31330 Summary: +relay corrupts returns values on win64? Product: Wine Version: 1.5.9 Platform: x86-64 OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: -unknown AssignedTo: wine-bugs@winehq.org ReportedBy: dank@kegel.com Classification: Unclassified
The little program
#include <float.h> #include <math.h> #include <stdio.h> int main(int argc, char **argv) { int log2FLT_RADIX; double x = frexp((double) FLT_RADIX, &log2FLT_RADIX); printf("x is %g; wanted == 0.5\n", x); if (frexp((double) FLT_RADIX, &log2FLT_RADIX) != 0.5) printf("Trouble! Not equal.\n"); else printf("Whew! Equal.\n"); }
(attached, with 32 and 64 bit binaries produced with visual c 2010)
prints out "Whew! Equal." normally, but when run with +relay, the 64 bit version prints out "Trouble! Not equal." The 32 bit version is fine.
This is a test case extracted from TCL, which aborts with "This code doesn't work on a decimal machine!" when that comparison fails (see http://brlcad.org/xref/source/src/other/tcl/generic/tclStrToD.c#L2176 ). (You can see that error if you like by starting tclsh.exe from the 64 bit download at http://www.activestate.com/activetcl/downloads with +relay on.)
While comparing doubles for equality is not a good idea, in this special case it ought to be ok, and it seems surprising that +relay would break it.
The output with +relay seems to show random 32 bit values for the return value
0030:Call msvcrt.frexp(4000000000000000,0022fd48) ret=140001020 0030:Ret msvcrt.frexp() retval=ffffffff ret=140001020 ... This code doesn't work on a decimal machine! ... abnormal program termination 0032:Ret KERNEL32.WriteConsoleA() retval=00000001 ret=7f4a2344372f 0032:Call KERNEL32.ExitProcess(00000003) ret=7f4a23453001
Adding a TRACE to frexp shows it's trying to return the right thing, and changes the supposed return value:
0036:Call msvcrt.frexp(4000000000000000,100d093c) ret=10082b8c trace:msvcrt:MSVCRT_frexp (2, 0x100d093c) returning 0.5, storing 2 0036:Ret msvcrt.frexp() retval=00000043 ret=10082b8c
http://bugs.winehq.org/show_bug.cgi?id=31330
--- Comment #1 from Dan Kegel dank@kegel.com 2012-07-26 17:17:33 CDT --- Created attachment 41172 --> http://bugs.winehq.org/attachment.cgi?id=41172 Test program (source plus 32 and 64 bit binaries)
http://bugs.winehq.org/show_bug.cgi?id=31330
Dan Kegel dank@kegel.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download, source, testcase
http://bugs.winehq.org/show_bug.cgi?id=31330
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |win64
http://bugs.winehq.org/show_bug.cgi?id=31330
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED
--- Comment #2 from Austin English austinenglish@gmail.com 2013-05-22 17:52:19 CDT --- austin@aw25 ~ $ WINEDEBUG=relay ~/wine64/loader/wine64 radix 2>&1 | grep -i equal Whew! Equal.
Okay in wine-1.5.30-206-g2b8b64f
http://bugs.winehq.org/show_bug.cgi?id=31330
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|FIXED |
--- Comment #3 from Austin English austinenglish@gmail.com 2013-05-22 17:53:55 CDT --- Whoops, that was the 32-bit. The 64-bit version does indeed fail: austin@aw25 ~ $ WINEDEBUG=relay ~/wine64/loader/wine64 radix64.exe 2>&1 | grep -i equal Trouble! Not equal.
http://bugs.winehq.org/show_bug.cgi?id=31330
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |45a2cf1e227de2408fa9c3222a6 | |cffe5182048a6 Status|REOPENED |RESOLVED Resolution| |FIXED
--- Comment #4 from Austin English austinenglish@gmail.com 2013-05-23 16:48:50 CDT --- http://source.winehq.org/git/wine.git/commitdiff/45a2cf1e227de2408fa9c3222a6...
austin@aw25 ~ $ WINEDEBUG=relay ~/wine64/loader/wine64 radix64.exe &> 64.txt austin@aw25 ~ $ grep -i equal 64.txt Whew! Equal.
really fixed this time :)
http://bugs.winehq.org/show_bug.cgi?id=31330
André H. nerv@dawncrow.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |nerv@dawncrow.de
http://bugs.winehq.org/show_bug.cgi?id=31330
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #5 from Alexandre Julliard julliard@winehq.org 2013-05-24 13:32:03 CDT --- Closing bugs fixed in 1.5.31.
https://bugs.winehq.org/show_bug.cgi?id=31330
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |focht@gmx.net Component|-unknown |ntdll