[Development] 5.7/5.8 gives unusable static ltcg x86 builds on MSVC 2015/2017

Mikkel Krautz mikkel at krautz.dk
Tue Apr 18 10:37:51 CEST 2017

MSVC 2015 has buggy magic statics, see
https://bugreports.qt.io/browse/QTBUG-58318 and

I worked around the issue by disabling them with -Zc:threadSafeInit-.

On Tue, Apr 18, 2017 at 3:46 AM, Kuba Ober <kuba at mareimbrium.org> wrote:
> Are -static -ltcg -debug-and-release x86 builds tested and supported? It seems that they are broken on at least MSVC 2015 and 2017, in both 5.7 and 5.8. That's using most recent production releases of either version of MSVC (no prereleases etc), and I build using most recent jom.
> For me; 5.8 in a debug build corrupts the heap early during static initialization and doesn't even get to main's body. A release build is will generally crash somewhere but due to lack of heap diagnostics it will get to run first, on a partially corrupted heap.
> 5.7 crashes in the release if you as much as use add a shortcut to a dummy widget and then return from main. Seems to be a different face of the same problem, although the debug version didn't crash.
> IIRC 5.6 was also crashing for me.
> Since this is reproducible on 2 different machines, and seems to point to a persistent problem - did anyone else run into it?
> I will file bug reports but would want to know first whether it's anything known. To be completely frank, I couldn't get any Qt version between 5.6 and 5.8, inclusive, to work under either MSVC 2015 or 2017 with -static -ltcg so it seems like an untested configuration that's exposing undefined behavior somewhere as the whole thing is globally optimized.
> I kinda need this to work. Unless I hear better ideas, I plan on stripping away code to see what it takes to make it not crash. With 5.8 it crashes even with no plugins linked in, the heap corruption is detected in a heap free from one of the Q_GLOBAL_STATICs in somewhere in Qt.
> Cheers, Kuba Ober
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development

More information about the Development mailing list