https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66826
--- Comment #1 from Daurnimator <quae at daurnimator dot com> --- nalaginrut (from #gcc irc channel) confirmed that the issue only occurs in GCC 5 at -O2 and higher. (the bug is *not* present in GCC 4.9 or at -O1). Note: only the compilation of shared.so matters (the main binary can be compiled with any setting or compiler and the same behaviour is shown.)