GCC Bugs

Issue With std::function (and lambdas) With gcc and arm

This specific bug has caused be much pain when cross-compiling C++ code for the Zynq 7020 SoC (which has ARM A9 processors on-board). This caused software to seg fault for not good reason. It appeared when trying to use a captured this inside of a lambda function.

Code To Cause Issue:

Note how the print to std::cout causes the bug to occur. Other, non-stream operations will likely cause a similar issue

Effects: Effects GCC v6.2.0, possibly others.

Workaround: Either compile with only -O0 or -O1 level optimizations, or add the gcc compiler flag -fno-schedule-insns2 (which disables instruction scheduling).

I posted a question on StackOverflow regarding this bug. Phillip Huppertz then found the bug logged in gcc’s bugzilla.


Posted: October 6th, 2017 at 10:46 am