Details
Description
Consider the following QML code
import QtQuick
Item {
property url foo
visible: foo?.toString()
}
When building it with qmlcachegen with a Qt debug build it will assert because a Q_UNREACHABLE is reached.
#0 __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44 #1 0x00007ffff389b453 in __pthread_kill_internal (threadid=<optimized out>, signo=6) at pthread_kill.c:89 #2 0x00007ffff3841cb6 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26 #3 0x00007ffff382938b in __GI_abort () at abort.c:73 #4 0x00007ffff41b0024 in qAbort () at /home/nico/workspace/qt6-dev/qtbase/src/corelib/global/qassert.cpp:46 #5 0x00007ffff420c1ae in qt_maybe_message_fatal<QString&> (msgType=msgType@entry=QtFatalMsg, context=..., message=...) at /home/nico/workspace/qt6-dev/qtbase/src/corelib/global/qlogging.cpp:2140 #6 0x00007ffff420c31f in qt_message(QtMsgType, const QMessageLogContext &, const char *, typedef __va_list_tag __va_list_tag *) (msgType=msgType@entry=QtFatalMsg, context=..., msg=msg@entry=0x7ffff4d2fcc0 "ASSERT failure in %s: \"%s\", file %s, line %d", a p=ap@entry=0x7bfff0470620) at /home/nico/workspace/qt6-dev/qtbase/src/corelib/global/qlogging.cpp:412 #7 0x00007ffff421abbd in QMessageLogger::fatal (this=this@entry=0x7bfff02ae3a0, msg=msg@entry=0x7ffff4d2fcc0 "ASSERT failure in %s: \"%s\", file %s, line %d") at /home/nico/workspace/qt6-dev/qtbase/src/corelib/global/qlogging.cpp:901 #8 0x00007ffff41b0303 in qt_assert_x (where=where@entry=0x7ffff75c5ac0 "Q_UNREACHABLE()", what=what@entry=0x7ffff75c5a80 "Q_UNREACHABLE was reached", file=file@entry =0x7ffff75c13a0 "/home/nico/workspace/qt6-dev/qtdeclarative/src/qmlcompiler/qqmljscodegenerator.cpp", line=line@entry=1551) at /home/nico/workspace/qt6-dev/qtbase/src/corelib/global/qassert.cpp:115 #9 0x00007ffff7148651 in QQmlJSCodeGenerator::generate_GetOptionalLookup (this=0x7bfff07d5950, index=<optimized out>, offset=<optimized out>) at /home/nico/workspace/qt6-dev/qtdeclarative/src/qmlcompiler/qqmljscodegenerator.cpp:1551 #10 0x00007ffff5d80da7 in QV4::Moth::ByteCodeHandler::decode (this=this@entry=0x7bfff07d5950, code=0x7c5ff17467d7 "XN\a\254\002\a", len=<optimized out>) at /home/nico/workspace/qt6-dev/qtdeclarative/src/qml/compiler/qv4bytecodehandler.cpp:41 #11 0x00007ffff710c71e in QQmlJSCodeGenerator::run (this=this@entry=0x7bfff07d5950, function=function@entry=0x7bfff05c26c0, basicBlocksValidationFailed=false) at /home/nico/workspace/qt6-dev/qtdeclarative/src/qmlcompiler/qqmljscodegenerator.cpp:185 #12 0x00007ffff71c9ba2 in QQmlJSAotCompiler::doCompile (this=this@entry=0x7bfff0902860, context=<optimized out>, function=function@entry=0x7bfff05c26c0) at /home/nico/workspace/qt6-dev/qtdeclarative/src/qmlcompiler/qqmljscompiler.cpp:790 #13 0x00007ffff71ca4d9 in QQmlJSAotCompiler::doCompileAndRecordAotStats (this=this@entry=0x7bfff0902860, context=context@entry=0x7d3ff15e7440, function=function@entry=0x7bfff05c26c0, name=..., locatio n=...) at /home/nico/workspace/qt6-dev/qtdeclarative/src/qmlcompiler/qqmljscompiler.cpp:804 #14 0x00007ffff71cb42f in QQmlJSAotCompiler::compileBinding (this=0x7bfff0902860, context=<optimized out>, irBinding=<optimized out>, astNode=<optimized out>) at /home/nico/workspace/qt6-dev/qtdeclarative/src/qmlcompiler/qqmljscompiler.cpp:679 #15 0x00007ffff71ce507 in operator() (__closure=__closure@entry=0x7bfff03a7370, bindingOrFunction=...) at /home/nico/workspace/qt6-dev/qtdeclarative/src/qmlcompiler/qqmljscompiler.cpp:320 #16 0x00007ffff71cfe73 in std::for_each<__gnu_cxx::__normal_iterator<BindingOrFunction*, std::vector<BindingOrFunction> >, qCompileQ mlFile(QmlIR::Document&, const QString&, QQmlJSSaveFunction, QQmlJSAotCompiler*, QQmlJSCompileError*, bool, QV4::Compiler::CodegenWa rningInterface*, const QString*)::<lambda(const BindingOrFunction&)> >(__gnu_cxx::__normal_iterator<BindingOrFunction*, std::vector< BindingOrFunction, std::allocator<BindingOrFunction> > >, __gnu_cxx::__normal_iterator<BindingOrFunction*, std::vector<BindingOrFunc tion, std::allocator<BindingOrFunction> > >, struct {...}) (__first=Python Exception <class 'gdb.error'>: value has been optimized o ut , __last=Python Exception <class 'gdb.error'>: value has been optimized out , __f=...) at /usr/include/c++/14/bits/stl_algo.h:3786 #17 0x00007ffff71d27f3 in qCompileQmlFile (irDocument=..., inputFileName=..., saveFunction=..., aotCompiler=aotCompiler@entry=0x7bfff0902860, error=error@entry=0x7bfff090 1e30, storeSourceLocation=storeSourceLocation@entry=true, interface=<optimized out>, fileContents=<optimized out>) at /home/nico/workspace/qt6-dev/qtdeclarative/src/qmlcompiler/qqmljscompiler.cpp:262 #18 0x00007ffff71d3248 in qCompileQmlFile (inputFileName=..., saveFunction=..., aotCompiler=aotCompiler@entry=0x7bfff0902860, error=error@entry=0x7bfff0901e30, storeSourc eLocation=storeSourceLocation@entry=true, interface=interface@entry=0x555555582010 <QV4::Compiler::defaultCodegenWarningInterface(): :iface>, fileContents=<optimized out>) at /home/nico/workspace/qt6-dev/qtdeclarative/src/qmlcompiler/qqmljscompiler.cpp:178 #19 0x0000555555563989 in main (argc=<optimized out>, argv=<optimized out>) at /home/nico/workspace/qt6-dev/qtdeclarative/tools/qmlcachegen/qmlcachegen.cpp:305
This isn happening both with current dev and 6.8.2
Attachments
For Gerrit Dashboard: QTBUG-135649 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
637723,7 | Compiler: Use regular lookup for redundant optional lookups | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
638152,9 | qmllint: Warn about redundant optional chaining | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
638791,2 | Compiler: Use regular lookup for redundant optional lookups | 6.9 | qt/qtdeclarative | Status: MERGED | +2 | 0 |
638899,3 | Compiler: Use regular lookup for redundant optional lookups | 6.8 | qt/qtdeclarative | Status: MERGED | +2 | 0 |