diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-06-01 11:12:12 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2022-06-02 02:42:51 +0200 |
commit | 405f1f7d05a27f659fa47afb5574a159301caff6 (patch) | |
tree | a8344797cd06ee3a039b4b731bb6e82e50ed8fcd /src | |
parent | cb2cccd5578ffcfcbf6793c0a445022a6fd4a8ae (diff) |
QV4::CompiledData: fix GCC 12 -Werror=uninitialized errors
The non-default ctors tried to call m_data.set(), where m_data
uninitialized.
Says GCC 12:
In member function ‘QSpecialIntegerAccessor<S, pos, width, T>& QSpecialIntegerAccessor<S, pos, width, T>::operator=(Type) [with S = QLittleEndianStorageType<unsigned int>; int pos = 0; int width = 5; T = unsigned int]’,
inlined from ‘void QSpecialIntegerBitfieldUnion<S, Accessors>::set(typename A::Type) [with A = QSpecialIntegerAccessor<QLittleEndianStorageType<unsigned int>, 0, 5, unsigned int>; S = QLittleEndianStorageType<unsigned int>; Accessors = {QSpecialIntegerAccessor<QLittleEndianStorageType<unsigned int>, 0, 5, unsigned int>, QSpecialIntegerAccessor<QLittleEndianStorageType<unsigned int>, 5, 27, unsigned int>}]’ at qtbase/src/corelib/global/qendian_p.h:214:21,
inlined from ‘QV4::CompiledData::RegExp::RegExp(quint32, quint32)’ at qtdeclarative/src/qml/common/qv4compileddata_p.h:187:31,
inlined from ‘int QV4::Compiler::JSUnitGenerator::registerRegExp(QQmlJS::AST::RegExpLiteral*)’ at qtdeclarative/src/qml/compiler/qv4compiler.cpp:198:34:
qtbase/src/corelib/global/qendian_p.h:179:40: error: ‘<unnamed>.QV4::CompiledData::RegExp::m_data.QSpecialIntegerBitfieldUnion<QLittleEndianStorageType<unsigned int>, QSpecialIntegerAccessor<QLittleEndianStorageType<unsigned int>, 0, 5, unsigned int>, QSpecialIntegerAccessor<QLittleEndianStorageType<unsigned int>, 5, 27, unsigned int> >::storage.QSpecialIntegerStorage<QLittleEndianStorageType<unsigned int> >::val’ is used uninitialized [-Werror=uninitialized]
179 | UnsignedType i = S::fromSpecial(storage->val);
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~
qtdeclarative/src/qml/compiler/qv4compiler.cpp: In member function ‘int QV4::Compiler::JSUnitGenerator::registerRegExp(QQmlJS::AST::RegExpLiteral*)’:
qtdeclarative/src/qml/compiler/qv4compiler.cpp:198:90: note: ‘<anonymous>’ declared here
198 | regexps.append(CompiledData::RegExp(flags, registerString(regexp->pattern.toString())));
| ^
Fix by calling the default ctor (which initialized m_data) before
calling m_data.set().
Pick-to: 6.3 6.2 5.15
Task-number: QTBUG-103924
Change-Id: I44ff404e5509e24601893e539639f213defdc80d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/common/qv4compileddata_p.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/qml/common/qv4compileddata_p.h b/src/qml/common/qv4compileddata_p.h index 98f33ea6a8..9bd2f62ab0 100644 --- a/src/qml/common/qv4compileddata_p.h +++ b/src/qml/common/qv4compileddata_p.h @@ -129,7 +129,7 @@ struct TableIterator struct Location { Location() : m_data(QSpecialIntegerBitfieldZero) {} - Location(quint32 l, quint32 c) + Location(quint32 l, quint32 c) : Location() { m_data.set<LineField>(l); m_data.set<ColumnField>(c); @@ -182,7 +182,7 @@ struct RegExp }; RegExp() : m_data(QSpecialIntegerBitfieldZero) {} - RegExp(quint32 flags, quint32 stringIndex) + RegExp(quint32 flags, quint32 stringIndex) : RegExp() { m_data.set<FlagsField>(flags); m_data.set<StringIndexField>(stringIndex); @@ -211,7 +211,7 @@ struct Lookup quint32 nameIndex() const { return m_data.get<NameIndexField>(); } Lookup() : m_data(QSpecialIntegerBitfieldZero) {} - Lookup(Type type, quint32 nameIndex) + Lookup(Type type, quint32 nameIndex) : Lookup() { m_data.set<TypeAndFlagsField>(type); m_data.set<NameIndexField>(nameIndex); |