Boost C++ Libraries: Ticket #12719: context test cases and examples segmentation fault when built with mingw-w64 toolchain https://svn.boost.org/trac10/ticket/12719 <p> I downloaded and successfully built Boost 1.63 with mingw-w64 (gcc.exe (x86_64-posix-seh-rev1, Built by MinGW-W64 project) 6.2.0) toolchain on a Windows 7 64 bits computer. </p> <p> I would like to use Boost.coroutines2. Unfortunately Boost.Context test cases and examples fail with a segmentation fault (except for test_apply and test_invoke). </p> <p> I tested with different versions of the toolchain, but without success: </p> <ol><li>gcc.exe (x86_64-posix-seh-rev1, Built by MinGW-W64 project) 6.2.0 </li><li>gcc.exe (x86_64-posix-sjlj-rev1, Built by MinGW-W64 project) 6.2.0 </li><li>gcc.exe (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 5.4.0 </li></ol><p> Running any example executable in GDB outputs the following message: </p> <pre class="wiki">Program received signal SIGSEGV, Segmentation fault. jump_fcontext () at jump_x86_64_ms_pe_gas.asm:191 191 jump_x86_64_ms_pe_gas.asm: No such file or directory. </pre><p> Am I missing a configuration settings? Is it a bug in jump_x86_64_ms_pe_gas.asm? Your help will be greatly appreciated. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/12719 Trac 1.4.3 olli Tue, 03 Jan 2017 18:34:14 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/12719#comment:1 https://svn.boost.org/trac10/ticket/12719#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> Ticket patrick.zani@… Wed, 04 Jan 2017 22:37:26 GMT attachment set https://svn.boost.org/trac10/ticket/12719 https://svn.boost.org/trac10/ticket/12719 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">jump_x86_64_ms_pe_gas.asm.patch</span> </li> </ul> Ticket anonymous Wed, 04 Jan 2017 22:37:51 GMT attachment set https://svn.boost.org/trac10/ticket/12719 https://svn.boost.org/trac10/ticket/12719 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">ontop_x86_64_ms_pe_gas.asm.patch</span> </li> </ul> Ticket patrick.zani@… Wed, 04 Jan 2017 22:45:18 GMT status, type, severity changed; resolution deleted https://svn.boost.org/trac10/ticket/12719#comment:2 https://svn.boost.org/trac10/ticket/12719#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">closed</span> → <span class="trac-field-new">reopened</span> </li> <li><strong>type</strong> <span class="trac-field-old">Support Requests</span> → <span class="trac-field-new">Bugs</span> </li> <li><strong>resolution</strong> <span class="trac-field-deleted">fixed</span> </li> <li><strong>severity</strong> <span class="trac-field-old">Problem</span> → <span class="trac-field-new">Regression</span> </li> </ul> <p> There are two problems, one in file jump_x86_64_ms_pe_gas.asm and the other in file ontop_x86_64_ms_pe_gas.asm. Register RCX is used instead of RAX. </p> <p> I fixed the issues and everything works like a charm with mingw-w64 toolchain. </p> <p> I attached both patch files to this ticket. </p> Ticket olli Thu, 05 Jan 2017 06:07:15 GMT <link>https://svn.boost.org/trac10/ticket/12719#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12719#comment:3</guid> <description> <p> Why do you reopen the bug?I've already fixed it and closed the bug report! </p> </description> <category>Ticket</category> </item> <item> <dc:creator>olli</dc:creator> <pubDate>Thu, 05 Jan 2017 06:07:36 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/12719#comment:4 https://svn.boost.org/trac10/ticket/12719#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">reopened</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> Ticket p.remmers@… Mon, 17 Apr 2017 14:30:47 GMT status changed; resolution deleted https://svn.boost.org/trac10/ticket/12719#comment:5 https://svn.boost.org/trac10/ticket/12719#comment:5 <ul> <li><strong>status</strong> <span class="trac-field-old">closed</span> → <span class="trac-field-new">reopened</span> </li> <li><strong>resolution</strong> <span class="trac-field-deleted">fixed</span> </li> </ul> <p> Unfortunately, the patch does not fix the crashes. When looking at the differences between the masm and the gas version, there is still something missing: + /* restore MMX control- and status-word */ + ldmxcsr 0xa0(%rsp) + /* restore x87 control-word */ + fldcw 0xa4(%rsp) </p> <p> I'll attach a patch, but I haven't verified it, because boost takes so long to rebuild, and I've had trouble doing an incremental build (the fix didn't end up in the package). I will write an update when the rebuild is done. Sadly, I've seen that the next release is imminent, and this fix will probably not be included until wednesday... </p> Ticket p.remmers@… Mon, 17 Apr 2017 14:31:55 GMT attachment set https://svn.boost.org/trac10/ticket/12719 https://svn.boost.org/trac10/ticket/12719 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost-1.63.0-fix-context.patch</span> </li> </ul> <p> add missing instructions to asm </p> Ticket p.remmers@… Mon, 17 Apr 2017 16:22:53 GMT <link>https://svn.boost.org/trac10/ticket/12719#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12719#comment:6</guid> <description> <p> Ok, so the rebuild is done, and I actually can't say whether that fixed it completely or not. The strange thing is, if you run the program it works and doesn't crash anymore (yay!). However, if you run it under gdb, there will be a SIGSEGV at the ldmxcsr 0xa0(%rsp) instruction in the jump_fcontext function. I don't know whether that's a problem with gdb or whether the problem is not really fixed yet. I can single step over that instruction with visual studio in an msvc build of boost and my test program no problem. I can even use the visual studio debugger and single step over that instruction in the executable that was built by mingw. So I really don't know what's going on here. The way this behaves, I'm going to assume that the problem is basically fixed, and that this is a gdb problem. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>olli</dc:creator> <pubDate>Sat, 22 Apr 2017 20:18:13 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/12719#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12719#comment:7</guid> <description> <p> could you check branch develop - should fixed now </p> </description> <category>Ticket</category> </item> <item> <author>p.remmers@…</author> <pubDate>Thu, 27 Apr 2017 22:13:25 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/12719#comment:8 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12719#comment:8</guid> <description> <p> Yes, it seems to work. </p> <p> It works, I can single step through the context switching disassembly, including the ldmxcsr instruction, and it does not crash. I compiled my test program using both gcc and clang. </p> <p> I've had some trouble finding it, sucking it out of github (successfully avoided having to learn git until now), and compiling it as an MSYS2 package. I did not completely manage to do it. Somehow after building, the coroutines2 headers are missing, so I switched my test program to use the old coroutines library. </p> <p> So aside from the other problems, I guess boost.context itself should be good now. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>olli</dc:creator> <pubDate>Tue, 13 Jun 2017 13:13:41 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/12719#comment:9 https://svn.boost.org/trac10/ticket/12719#comment:9 <ul> <li><strong>status</strong> <span class="trac-field-old">reopened</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> Ticket