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

qmlcachegen generates invalid code

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 6.4.0 Beta1
    • 6.4
    • QML: Compiler
    • None
    • 8a229c38fb (qt/qtdeclarative/dev) 8a229c38fb (qt/tqtc-qtdeclarative/dev)

    Description

      The QML makes qmlcachegen generate invalid code:

      pragma Strict
      import QtQuick 6
      
      Item {
          height: !(parent && parent.visible && parent.x) ? 100 : 0
      }
      

      The result is:

      bool r2_1;
      double r2_3;
      QObject *r2_2;
      // generate_LoadQmlContextPropertyLookup
      {
      QObject * retrieved;
      while (!aotContext->loadScopeObjectPropertyLookup(0, &retrieved)) {
      aotContext->setInstructionPointer(2);
      aotContext->initLoadScopeObjectPropertyLookup(0, []() { static const auto t = QMetaType::fromName("QQuickItem*"); return t; }());
      if (aotContext->engine->hasError())
          return 0.0;
      }
      r2_1 = (retrieved != nullptr);
      }
      // generate_JumpFalse
      if (!r2_1) {
          goto label_0;
      }
      ;
      // generate_LoadQmlContextPropertyLookup
      while (!aotContext->loadScopeObjectPropertyLookup(1, &r2_2)) {
      aotContext->setInstructionPointer(6);
      aotContext->initLoadScopeObjectPropertyLookup(1, []() { static const auto t = QMetaType::fromName("QQuickItem*"); return t; }());
      if (aotContext->engine->hasError())
          return 0.0;
      }
      // generate_GetLookup
      while (!aotContext->getObjectLookup(2, r2_2, &r2_1)) {
      aotContext->setInstructionPointer(8);
      aotContext->initGetObjectLookup(2, r2_2, QMetaType::fromType<bool>());
      if (aotContext->engine->hasError())
          return 0.0;
      }
      label_0:;
      // generate_JumpFalse
      if (!r2_1) {
          goto label_1;
      }
      ;
      // generate_LoadQmlContextPropertyLookup
      while (!aotContext->loadScopeObjectPropertyLookup(3, &r2_2)) {
      aotContext->setInstructionPointer(12);
      aotContext->initLoadScopeObjectPropertyLookup(3, []() { static const auto t = QMetaType::fromName("QQuickItem*"); return t; }());
      if (aotContext->engine->hasError())
          return 0.0;
      }
      // generate_GetLookup
      while (!aotContext->getObjectLookup(4, r2_2, &r2_3)) {
      aotContext->setInstructionPointer(14);
      aotContext->initGetObjectLookup(4, r2_2, QMetaType::fromType<double>());
      if (aotContext->engine->hasError())
          return 0.0;
      }
      label_1:;
      // generate_UNot
      r2_1 = !bool(r2_3);
      // generate_JumpFalse
      if (!r2_1) {
          goto label_2;
      }
      ;
      // generate_LoadInt
      r2_3 = double(100);
      // generate_Jump
      {
          goto label_3;
      }
      ;
      label_2:;
      // generate_LoadZero
      r2_3 = double(0);
      label_3:;
      // generate_Ret
      return r2_3;
      

      Clearly, r2_3 can be uninitialized when we hit the UNot instruction.

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-102281
          # Subject Branch Project Status CR V

          Activity

            People

              ulherman Ulf Hermann
              ulherman Ulf Hermann
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes