https://bugs.winehq.org/show_bug.cgi?id=55052
Bug ID: 55052 Summary: For loop where right bound is string coercion issue Product: Wine Version: 8.9 Hardware: aarch64 OS: Mac OS X Status: UNCONFIRMED Severity: normal Priority: P2 Component: vbscript Assignee: wine-bugs@winehq.org Reporter: francisdb@gmail.com
Dim i, num num = "16" For i = 0 To num WScript.Echo i Next
On windows using cscript this loops 16 times
Using wine vbscript this loops a lot further (at least 5022747)
As a workaround you can of course use 16 or CInt(num)
https://bugs.winehq.org/show_bug.cgi?id=55052
francisdb francisdb@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |source
https://bugs.winehq.org/show_bug.cgi?id=55052
francisdb francisdb@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|For loop where right bound |vbscript: For loop where |is string coercion issue |right bound is string | |coercion issue
https://bugs.winehq.org/show_bug.cgi?id=55052
Robert Wilhelm sloper42@yahoo.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW CC| |sloper42@yahoo.com Ever confirmed|0 |1
--- Comment #1 from Robert Wilhelm sloper42@yahoo.com --- confirming
https://bugs.winehq.org/show_bug.cgi?id=55052
temp82@luukku.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |temp82@luukku.com
--- Comment #2 from temp82@luukku.com --- not working correctly wine 8.21.
https://bugs.winehq.org/show_bug.cgi?id=55052
--- Comment #3 from Nikolay Sivov bunglehead@gmail.com --- This does not appear to be a VarCmp() issue, unfortunately. It always returns string argument as "greater", so we'll need to coerce explicitly.
https://bugs.winehq.org/show_bug.cgi?id=55052
--- Comment #4 from Robert Wilhelm sloper42@yahoo.com --- Created attachment 75585 --> https://bugs.winehq.org/attachment.cgi?id=75585 coerce "to"
This is my wip patch. It fixes the issue. But I have to add additional tests to check whether we need to coerce "for" and "step" and what is right type to coerce to.
https://bugs.winehq.org/show_bug.cgi?id=55052
--- Comment #5 from Robert Wilhelm sloper42@yahoo.com --- Tests show that for iterator, String in coerced to VT_R8 while other numeric types (I tested I2,I4) are not changed.
https://bugs.winehq.org/show_bug.cgi?id=55052
--- Comment #6 from Nikolay Sivov bunglehead@gmail.com --- It's also worth testing what happens to the iteration step argument. I suspect that roughly the idea is to use types that won't produce precision loss, for some definition of loss. E.g. strings are producing floats, and then sum/compare is using either floats unconditionally or when one side is a float. I don't now how to test that properly, maybe using step of "1.6", limit as "2" and see how many iteration this produces.
In any case, after converting strings to something numeric, VarCmp() should start working properly.
https://bugs.winehq.org/show_bug.cgi?id=55052
--- Comment #7 from Robert Wilhelm sloper42@yahoo.com --- Created attachment 75594 --> https://bugs.winehq.org/attachment.cgi?id=75594 test case
Test show that iterator has always highest precision. E.g. if there is a VT_BSTR in for, to or step, iterator will have type VT_R8.
https://bugs.winehq.org/show_bug.cgi?id=55052
Robert Wilhelm sloper42@yahoo.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch
--- Comment #8 from Robert Wilhelm sloper42@yahoo.com --- https://gitlab.winehq.org/wine/wine/-/merge_requests/4615
https://bugs.winehq.org/show_bug.cgi?id=55052
Robert Wilhelm sloper42@yahoo.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|NEW |RESOLVED
--- Comment #9 from Robert Wilhelm sloper42@yahoo.com --- Fixed by https://gitlab.winehq.org/wine/wine/-/commit/e0d027830e6d359d390c257bbb54191...
https://bugs.winehq.org/show_bug.cgi?id=55052
Robert Wilhelm sloper42@yahoo.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |e0d027830e6d359d390c257bbb5 | |419157d9d5aac
https://bugs.winehq.org/show_bug.cgi?id=55052
--- Comment #10 from francisdb francisdb@gmail.com --- Thanks!
https://bugs.winehq.org/show_bug.cgi?id=55052
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #11 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 9.0-rc1.