Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-135342

qmlcachegen crashes in QQmlJSTypeResolver::genericType

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P1: Critical
    • 6.9
    • 6.9
    • QML: Compiler
    • None
    • Fedora 42

    Description

      Consider the following code:

      #pragma once
      #include <QObject>
      #include <QQmlEngine>
      
      class Thing : public QObject
      {
          Q_OBJECT
          QML_ELEMENT
      public:
          enum Bla : uint_fast8_t {
              Yo = 1,
          };
          Q_ENUM(Bla)
      }; 
      import QtQuick
      import com.foo as FB
      Item {
          property var foo: FB.Thing.Yo
      }
      

      Full project at https://invent.kde.org/nicolasfella/enumtest

      When building qmlcachegen crashes with

      #0  QQmlJSTypeResolver::genericType (this=this@entry=0x7ffeb9333690, type=..., allowComponent=allowComponent@entry=QQmlJSTypeResolver::ComponentIsGeneric::No)
      
          at /home/nico/workspace/qt6/qtbase/src/corelib/global/qflags.h:170
      
      #1  0x00007fe4443ccd57 in QQmlJSTypeResolver::generalizeType (this=0x7ffeb9333690, type=...)
      
          at /home/nico/workspace/qt6/qtdeclarative/src/qmlcompiler/qqmljstyperesolver.cpp:558
      
      #2  0x00007fe44439bebd in operator() (__closure=<synthetic pointer>, content=<optimized out>)
      
          at /home/nico/workspace/qt6/qtdeclarative/src/qmlcompiler/qqmljsstoragegeneralizer.cpp:40
      
      #3  QQmlJSStorageGeneralizer::run (this=this@entry=0x7ffeb9331d40, function=function@entry=0x7ffeb9332790)
      
          at /home/nico/workspace/qt6/qtdeclarative/src/qmlcompiler/qqmljsstoragegeneralizer.cpp:56
      
      #4  0x00007fe4442a0bde in QQmlJSAotCompiler::doCompile (this=0x7ffeb9333680, context=<optimized out>,  
          context@entry=0x5646de626000, function=function@entry=0x7ffeb9332790, errors=<optimized out>, errors@entry=0x7ffeb9332680)
      
          at /home/nico/workspace/qt6/qtdeclarative/src/qmlcompiler/qqmljscompiler.cpp:806
      
      #5  0x00007fe4442a1152 in QQmlJSAotCompiler::doCompileAndRecordAotStats
      
          (this=this@entry=0x7ffeb9333680, context=context@entry=0x5646de626000, function=function@entry=0x7ffeb9332790, errors=errors@entry=0x7ffeb9332680, name=..., locatio
      n=...) at /home/nico/workspace/qt6/qtdeclarative/src/qmlcompiler/qqmljscompiler.cpp:823
      
      #6  0x00007fe4442a1609 in QQmlJSAotCompiler::compileBinding (this=0x7ffeb9333680, context=0x5646de626000, irBinding=<optimized out>, astNode=0x5646de139a58)
      
          at /home/nico/workspace/qt6/qtdeclarative/src/qmlcompiler/qqmljscompiler.cpp:695
      
      #7  0x00007fe4442a56be in operator() (__closure=<synthetic pointer>, bindingOrFunction=...)
      
          at /home/nico/workspace/qt6/qtdeclarative/src/qmlcompiler/qqmljscompiler.cpp:331
      
      #8  std::for_each<__gnu_cxx::__normal_iterator<BindingOrFunction*, std::vector<BindingOrFunction> >, qCompileQmlFile(QmlIR::Document&, const QString&, QQmlJSSaveFunctio
      n, QQmlJSAotCompiler*, QQmlJSCompileError*, bool, QV4::Compiler::CodegenWarningInterface*, const QString*)::<lambda(const BindingOrFunction&)> >
      
          (__first=..., __last=..., __f=...) at /usr/include/c++/15/bits/stl_algo.h:3772
      
      #9  qCompileQmlFile
      
          (irDocument=..., inputFileName=..., saveFunction=..., aotCompiler=aotCompiler@entry=0x7ffeb9333680, error=error@entry=0x7ffeb9333420, storeSourceLocation=<optimized
       out>, interface=<optimized out>, fileContents=<optimized out>) at /home/nico/workspace/qt6/qtdeclarative/src/qmlcompiler/qqmljscompiler.cpp:273
      
      #10 0x00007fe4442a6924 in qCompileQmlFile
      
          (inputFileName=..., saveFunction=..., aotCompiler=aotCompiler@entry=0x7ffeb9333680, error=error@entry=0x7ffeb9333420, storeSourceLocation=storeSourceLocation@entry=
      true, interface=0x5646b9c98008 <QV4::Compiler::defaultCodegenWarningInterface()::iface>, fileContents=0x0)
      
          at /home/nico/workspace/qt6/qtdeclarative/src/qmlcompiler/qqmljscompiler.cpp:189
      
      #11 0x00005646b9c8d132 in main (argc=<optimized out>, argv=<optimized out>) at /home/nico/workspace/qt6/qtdeclarative/tools/qmlcachegen/qmlcachegen.cpp:305
      

      qtdeclarative from 6.9 branch (commit 0927a2eb35d67eaec40aba6b64b032ad6b49de6b)

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qtqmlteam Qt Qml Team User
            nicolasfella Nicolas Fella
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes