|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The quint32_le_bitfield class, like its underlying type, doesn't
provide a user-defined constructor, so default-construction leaves the
'val' member uninitialized. When the user-defined assignment operator
then tries to read from 'val', that is undefined behavior. Or would, if
vector::resize() wouldn't value-initialize, which it is required to do.
So, False Positive, but due to -Werror, we need to do something about it
(value-initialize the largest union member before calling assignment).
Says GCC 11 with -stc=c++20 -fsanitize=undefined -Werror:
In member function ‘QSpecialIntegerBitfield<S, pos, width>& QSpecialIntegerBitfield<S, pos, width>::operator=(QSpecialIntegerBitfield<S, pos, width>::T) [with S = QLittleEndianStorageType<unsigned int>; int pos = 0; int width = 30]’,
inlined from ‘icutils::Node::Node(std::vector<QV4::CompiledData::InlineComponent>::size_type)’ at qt5-build/qtbase/include/QtQml/6.3.0/QtQml/private/../../../../../../../qt5/qtdeclarative/src/qml/inlinecomponentutils_p.h:66:26,
inlined from ‘constexpr void std::iota(_ForwardIterator, _ForwardIterator, _Tp) [with _ForwardIterator = __gnu_cxx::__normal_iterator<icutils::Node*, std::vector<icutils::Node> >; _Tp = int]’ at /d/gcc/11/include/c++/11.2.1/bits/stl_numeric.h:99:4,
inlined from ‘void QV4::ExecutableCompilationUnit::finalizeCompositeType(QQmlEnginePrivate*, CompositeMetaTypeIds)’ at qt5/qtdeclarative/src/qml/jsruntime/qv4executablecompilationunit.cpp:444:14:
qt5-build/qtbase/include/QtCore/6.3.0/QtCore/private/../../../../../../../qt5/qtbase/src/corelib/global/qendian_p.h:78:30: warning: ‘*(QSpecialIntegerBitfield<QLittleEndianStorageType<unsigned int>, 0, 30>*)((char*)&<unnamed> + offsetof(icutils::Node, icutils::Node::<unnamed>)).QSpecialIntegerBitfield<QLittleEndianStorageType<unsigned int>, 0, 30>::val’ may be used uninitialized [-Wmaybe-uninitialized]
78 | UT i = S::fromSpecial(val);
| ~~~~~~~~~~~~~~^~~~~
In file included from /d/gcc/11/include/c++/11.2.1/numeric:62,
from qt5/qtbase/src/corelib/tools/qhashfunctions.h:47,
from qt5-build/qtbase/include/QtCore/qhashfunctions.h:1,
from qt5/qtbase/src/corelib/tools/qlist.h:46,
from qt5-build/qtbase/include/QtCore/qlist.h:1,
from qt5/qtbase/src/corelib/kernel/qobject.h:49,
from qt5-build/qtbase/include/QtCore/qobject.h:1,
from qt5/qtbase/src/corelib/animation/qabstractanimation.h:43,
from qt5-build/qtbase/include/QtCore/qabstractanimation.h:1,
from qt5-build/qtbase/include/QtCore/QtCore:9,
from qt5-build/qtdeclarative/src/qml/CMakeFiles/Qml.dir/cmake_pch.hxx:5,
from <command-line>:
/d/gcc/11/include/c++/11.2.1/bits/stl_numeric.h: In member function ‘void QV4::ExecutableCompilationUnit::finalizeCompositeType(QQmlEnginePrivate*, CompositeMetaTypeIds)’:
/d/gcc/11/include/c++/11.2.1/bits/stl_numeric.h:99:20: note: ‘<anonymous>’ declared here
99 | *__first = __value;
| ~~~~~~~~~^~~~~~~~~
Pick-to: 6.3 6.2 5.15
Change-Id: I8bbe32438489120bd005e115ea34cd816c898116
Reviewed-by: Fabian Kosmale <[email protected]>
Reviewed-by: Thiago Macieira <[email protected]>
|