Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#12411 closed Bugs (fixed)

Boost coroutines 1.61 do not preserve fpu registers with O2 optimizations in Visual Studio

Reported by: martin_haas@… Owned by: olli
Milestone: To Be Determined Component: context
Version: Boost 1.61.0 Severity: Problem
Keywords: fpu registers Cc:

Description

When compiling program with O2 optimization setting, coroutine function is not preserving the fpu registers. This does work correctly in 1.60, but not 1.61. I saw that this attribute was removed in 1.61.

Attachments (1)

BoostCoroutineTest.cpp (6.7 KB ) - added by martin_haas@… 6 years ago.
Source code to show coroutine issue

Download all attachments as: .zip

Change History (9)

comment:1 by olli, 6 years ago

could you provide code that demonstrates the problem, please

by martin_haas@…, 6 years ago

Attachment: BoostCoroutineTest.cpp added

Source code to show coroutine issue

comment:2 by martin_haas@…, 6 years ago

Please see the attached file. When compiled with Visual Studio 2015, the Debug versions work correctly. The release version works correctly if optimization is disabled. If optimization is specified as O2 or Ox, it appears the fpu registers are being cleared. In the working versions, the final job completes at time 54. In the nonworking versions, the final job appears to take zero time, so it completes at time 44.

if the "hold" function is changed to return an int instead of a double, the optimized programs work correctly.

The program works correctly with boost 1.60, but not 1.61.

Thanks for all your hard work. The performance of the coroutines are MUCH better than my current solution. Hope this is an easy fix.

Thanks

comment:3 by olli, 6 years ago

unfortunately, boost.coroutine is deprecated and will not be fixed or developed further. You coud use boost.context, boost.coroutine2 (no symmetric coroutines) or boot.fiber instead.

For the problem you mentioned - could you provide a simple example using boost.context that demonstrates problems with the FPU env, please?

comment:4 by olli, 6 years ago

Component: coroutinecontext

comment:5 by olli, 6 years ago

Severity: ShowstopperProblem

comment:6 by olli, 6 years ago

Resolution: fixed
Status: newclosed

in reply to:  6 ; comment:7 by martin_haas@…, 6 years ago

Replying to olli: Thanks Oliver. I verified that the change worked for me. Will this change in Boost Context be rolled into the Boost 1.63 release?

Thanks

in reply to:  7 comment:8 by anonymous, 6 years ago

Replying to martin_haas@…:

Will this change in Boost Context be rolled into the Boost 1.63 release?

yes

Note: See TracTickets for help on using tickets.