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

QFuture::result() crashes with _GLIBCXX_DEBUG

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P1: Critical
    • None
    • 6.4.2, 6.7.1
    • Core: Threads
    • None
    • Linux/Wayland, Linux/X11

    Description

      When compiling with -fsanitize=address -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC, a program which uses the `QPromise` interface crashes with the following message:

      /usr/bin/../lib64/gcc/x86_64-suse-linux/13/../../../../include/c++/13/debug/safe_iterator.h:314:
      In function:
          gnu_debug::_Safe_iterator::pointer 
          gnu_debug::_Safe_iterator<std::_Rb_tree_const_iterator<std::pair<const 
          int, QtPrivate::ResultItem>>, std::map<int, QtPrivate::ResultItem>, 
          std::forward_iterator_tag>::operator->() const [_Iterator = 
          std::_Rb_tree_const_iterator<std::pair<const int, 
          QtPrivate::ResultItem>>, _Sequence = std::map<int, 
          QtPrivate::ResultItem>, _Category = std::forward_iterator_tag]
      
      Error: attempt to dereference a singular (value-initialized) iterator.
      
      Objects involved in the operation:
          iterator "this" @ 0x7f8fdc409240 {
            type = std::_Rb_tree_const_iterator<std::pair<int const, QtPrivate::ResultItem> > (constant iterator);
            state = singular (value-initialized);
          }
      Aborted (core dumped)
      

      Tested with clang15 and gcc13 on openSuSE Leap 15.5 (Qt 6.4.2) and Tumbleweed (Qt 6.7.1). Qt5 is not affected, using the undocumented QFutureInterface class.
      Command line:

      /usr/libexec/qt6/moc -o demo2.moc -i demo2.cpp
      g++ -fsanitize=address -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC -g -O2 -I/usr/include/qt6 -I/usr/include/qt6/QtCore -odemo2 demo2.cpp -lQt6Core
      

      Attachments

        1. demo2.cpp
          1.0 kB
          Bjarne von Horn
        2. stacktrace.txt
          4 kB
          Bjarne von Horn
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            thiago Thiago Macieira
            igh-vh Bjarne von Horn
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes