[Bug 48160] cl.exe (visual studio 2017) fails to compile c++ due to error C2177: constant too big

WineHQ Bugzilla wine-bugs at winehq.org
Thu Dec 12 14:20:00 CST 2019


https://bugs.winehq.org/show_bug.cgi?id=48160

--- Comment #4 from Erich E. Hoover <erich.e.hoover at gmail.com> ---
Created attachment 65950
  --> https://bugs.winehq.org/attachment.cgi?id=65950
override the x87 FPU control word in strtod_helper (even on x86-64)

Sorry for the duplicate :/

I've been investigating this a bit and this one is very tricky...
1) this is not a "real" regression, the patch is doing the exact correct
behavior (lots of testbot results here)
2) there is no special undocumented flag that the application is sending to
request different behavior
3) none of the fp*/fe* functions appear to touch the x87 FPU
4) the application itself does not appear to change the x87 FPU control word
5) the small number of x87 FPU instructions within Wine are not codepaths that
the application is exercising
6) there are no relevant stubs being called (just
__telemetry_main_return_trigger)
7) ignoring x87 FPU errors in _statusfp does not help

So, I started looking for routines that flag MSVCRT_ERANGE and discovered that
the problem is occurring in msvcrt:string.c:strtod_helper because of our use of
"long double".  Apparently, this causes gcc to generate x87 FPU instructions
instead of SSE2 instructions so our now-correct x87 precision is coming back to
bite us.  There are a couple ways to work around this:
1) override the x87 FPU settings within the context of this calculation
2) try to change the routine to be able to work with regular doubles
3) write our own SSE2 assembly to handle this case

I've attached a patch that takes approach #1 and would appreciate some feedback
on whether this looks suitable.

-- 
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.



More information about the wine-bugs mailing list