Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.15
-
d53fdc516b62cf9e5977f0ab597432033ef790ae (qt/qtdeclarative/dev)
Description
I used Qt 5.15 (git branch) compiled with "./configure -sanitize address -sanitize undefined" (with gcc/linux/amd64),
when I run "hello world" QML I got:
/home/evgeniy/bigdisk1/projects/cpp-infra/qt5/qtdeclarative/src/qml/qml/qqmljavascriptexpression.cpp:204:32: runtime error: reference binding to misaligned address 0x6170000007bc for type 'struct Object *', which requires 8 byte alignment 0x6170000007bc: note: pointer points here 40 60 00 00 08 b0 68 fa 73 7f 00 00 00 b0 68 fa 73 7f 00 00 00 04 09 fa 73 7f 00 00 80 0b 09 fa ^ ../../include/QtQml/5.15.0/QtQml/private/../../../../../../../qtdeclarative/src/qml/jsruntime/qv4value_p.h:324:33: runtime error: load of misaligned address 0x6170000007bc for type 'struct Object *', which requires 8 byte alignment 0x6170000007bc: note: pointer points here 40 60 00 00 08 b0 68 fa 73 7f 00 00 00 b0 68 fa 73 7f 00 00 00 04 09 fa 73 7f 00 00 80 0b 09 fa ^
As I understand here we got access to not aligned to 8 bytes pointer:
QV4::ExecutionEngine *v4 = m_context->engine->handle(); callData->thisObject = v4->globalObject;
In general it should handled by compiler just fine, because of
EngineBase is packed,
but `operator=` is overloaded via:
template<typename Managed> inline StaticValue &StaticValue::operator=(const Managed &m) { *static_cast<Value *>(this) = m; return *this; }
and this code already thinks that `m` is properly aligned,
so it may be undefined behaviour.