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

Generated moc files trigger -fsanitize=undefined

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P4: Low
    • None
    • 5.6.0, 5.8
    • Core: Object Model
    • None

    Description

      At runtime with some dev commit (I don't know which) I get:

      tester.moc:83:28: runtime error: member access within address 0x0000023a6ed0 which does not point to an object of type 'QObjectData'
      0x0000023a6ed0: note: object is of type 'QObjectPrivate'
       00 00 00 00  98 26 8b af 42 7f 00 00  70 98 6a 29 fc 7f 00 00  00 00 00 00 00 00 00 00  40 98 73 af
                    ^~~~~~~~~~~~~~~~~~~~~~~
                    vptr for 'QObjectPrivate'
      

      This does not happen with Qt 5.5. I didn't check intermediate versions.

      playground/qt/qmake{master}$ cat ../qt.pro 
      
      TEMPLATE = app
      TARGET = qttester
      
      QT += testlib
      
      CONFIG += release
      
      QMAKE_CXXFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls -fsanitize=undefined
      QMAKE_LFLAGS += -fsanitize=undefined
      
      SOURCES += tester.cpp
       
      playground/qt/qmake{master}$ cat ../tester.cpp 
      #include <QTest>
      
      class Tester : public QObject
      {
          Q_OBJECT
      private Q_SLOTS:
          void doTest();
      };
      
      void Tester::doTest()
      {
      
      }
      
      QTEST_MAIN(Tester)
      
      #include "tester.moc"
       
      playground/qt/qmake{master}$ qmake ..
       
      playground/qt/qmake{master}$ make 
      makeobj[0]: Entering directory `/home/stephen/dev/src/playground/qt/qmake'
      /home/stephen/dev/prefix/qtbase/bin/moc -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_TESTLIB_LIB -DQT_CORE_LIB -DQT_TESTCASE_BUILDDIR='"/home/stephen/safe/dev/playground/qt/qmake"' -I/home/stephen/dev/prefix/qtbase/mkspecs/linux-g++ -I/home/stephen/safe/dev/playground/qt -I/home/stephen/dev/prefix/qtbase/include -I/home/stephen/dev/prefix/qtbase/include/QtGui -I/home/stephen/dev/prefix/qtbase/include/QtTest -I/home/stephen/dev/prefix/qtbase/include/QtCore -I. -I/usr/include/c++/5 -I/usr/include/x86_64-linux-gnu/c++/5 -I/usr/include/c++/5/backward -I/usr/lib/gcc/x86_64-linux-gnu/5/include -I/usr/local/include -I/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed -I/usr/include/x86_64-linux-gnu -I/usr/include ../tester.cpp -o tester.moc
      g++ -c -pipe -fno-omit-frame-pointer -fno-optimize-sibling-calls -fsanitize=undefined -O2 -std=gnu++11 -std=c++11 -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_TESTLIB_LIB -DQT_CORE_LIB -DQT_TESTCASE_BUILDDIR='"/home/stephen/safe/dev/playground/qt/qmake"' -I../../qt -I. -I/home/stephen/dev/prefix/qtbase/include -I/home/stephen/dev/prefix/qtbase/include/QtGui -I/home/stephen/dev/prefix/qtbase/include/QtTest -I/home/stephen/dev/prefix/qtbase/include/QtCore -I. -I/home/stephen/dev/prefix/qtbase/mkspecs/linux-g++ -o tester.o ../tester.cpp
      g++ -fsanitize=undefined -Wl,-O1 -Wl,-rpath,/home/stephen/dev/prefix/qtbase/lib -o qttester tester.o   -L/home/stephen/dev/prefix/qtbase/lib -lQt5Gui -lQt5Test -lQt5Core -lGL -lpthread 
      makeobj[0]: Leaving directory `/home/stephen/dev/src/playground/qt/qmake'
       
      playground/qt/qmake{master}$ ./qttester 
      tester.moc:83:28: runtime error: member access within address 0x0000023a6ed0 which does not point to an object of type 'QObjectData'
      0x0000023a6ed0: note: object is of type 'QObjectPrivate'
       00 00 00 00  98 26 8b af 42 7f 00 00  70 98 6a 29 fc 7f 00 00  00 00 00 00 00 00 00 00  40 98 73 af
                    ^~~~~~~~~~~~~~~~~~~~~~~
                    vptr for 'QObjectPrivate'
      ********* Start testing of Tester *********
      Config: Using QtTest library 5.8.0, Qt 5.8.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 5.2.1 20151010)
      PASS   : Tester::initTestCase()
      PASS   : Tester::doTest()
      PASS   : Tester::cleanupTestCase()
      Totals: 3 passed, 0 failed, 0 skipped, 0 blacklisted, 0ms
      ********* Finished testing of Tester *********
      

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            steveire Stephen Kelly (Personal)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes