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

QString operator+ crashes

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P3: Somewhat important
    • None
    • 5.12.1
    • None
    • macOS

    Description

      Pretty straightforward, following snippet just crashes on my machine. I don't know if it is something to do with Clang or Qt, but I wanted to bring it up here.

      #include <QtCore>
      
      int main(int argc, char *argv[])
      {
          QCoreApplication a(argc, argv);
      
          QVector<QString> vector;
          vector.append("Hello");
      
          // but vector.value(0) doesn't crash
          const QString& ref = vector.at(0);
          vector.append(ref + '/');
          vector.append(ref + '/');
          vector.append(ref + '/');
          vector.append(ref + '/');
          vector.append(ref + '/');
          vector.append(ref + '/');
          vector.append(ref + '/');
          vector.append(ref + '/');
          vector.append(ref + '/');
          vector.append(ref + '/');
          vector.append(ref + '/');
          vector.append(ref + '/');
          vector.append(ref + '/');
          vector.append(ref + '/');
          vector.append(ref + '/');
          vector.append(ref + '/');
          vector.append(ref + '/');
      
          return a.exec();
      }
      

      My Setup:
      macOS 10.14.3
      Apple LLVM version 10.0.0 (clang-1000.11.45.2)
      Target: x86_64-apple-darwin18.2.0

      My Stack Trace:

      thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
      1 std::__atomic_base<int, false>::load(std::memory_order) const atomic 929 0x109619442 
      2 int QAtomicOps<int>::load<int>(std::atomic<int> const&) qatomic_cxx11.h 227 0x10961940b 
      3 QBasicAtomicInteger<int>::load() const qbasicatomic.h 103 0x1096193c5 
      4 QtPrivate::RefCount::ref() qrefcount.h 55 0x109619719 
      5 QString::QString(QString const&) qstring.h 958 0x1096196e8 
      6 QString::QString(QString const&) qstring.h 958 0x10961957d 
      7 operator+(QString const&, char) qstring.h 1363 0x1096191b9 
      8 main main.cpp 17 0x109618988 
      9 start (x86_64) /usr/lib/system/libdyld.dylib 0x7fff73baced9
      

      Attachments

        1. stack_trace.png
          stack_trace.png
          123 kB
        2. untitled30.zip
          2 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            thiago Thiago Macieira
            kozmon Ömer Göktaş
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes