Details
-
Bug
-
Resolution: Invalid
-
P2: Important
-
None
-
5.7.0
-
None
-
INTEGRITY OS
Green Hills Software Compiler
Description
Static constant variables get initialized before the core containers on a static build. This behaviour was observed on the INTEGRITY OS when using the GHS tool chain to produce a static build of QT 5.7.
One specific example is the following:
The statement Q_DECLARE_METATYPE(QMatrix2x2) in qgenericmatrix.h leads to the creation of a variable:
const int newId = qRegisterMetaType< QMatrix2x2 >("QMatrix2x2",
reinterpret_cast< QMatrix2x2 *>(quintptr(-1)));
This variable is instantiated in qgenericmatrix.cpp.
At the same time the qRegisterMetaType function call leads to a call to QMetaType::registerNormalizedType, which requires that QArrayData::shared_null is initialized.
QArrayData::shared_null is instantiated in qarraydata.cpp as:
const QArrayData QArrayData::shared_null[2] = {
, // shared null
/* zero initialized terminator */};
Both these variables are constant and reside in different compilation units and hence the C++ standard does not define the order in which the static initialization occurs.
This is currently only reproducible with the GHS toolchain.