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

QCoreApplication::arguments() crashes randomly on Linux amd64 in optimized build

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 5.9.0
    • Core: Other
    • None

    Description

      With a 64-bit Linux amd64 build and Qt 5.9.0, the following will randomly crash (~50% of the time) with optimization (-O2) enabled:

      #include <QtCore>

      QCoreApplication *g_app;

      void AA_init(int argc, char *argv[])
      {{{}}
        g_app = new QCoreApplication(argc, argv);
      }

      void AA_run()
      {{{}}
        QCoreApplication::arguments();
      }

      int main(int argc, char *argv[])
      {{{}}
        AA_init(argc, argv);
        AA_run();
      }

       I can eliminate the crash by:

      • Moving the "arguments()" call to follow the "new" statement in "AA_init()".
      • Moving "AA_run()" to follow the "new" statement in "AA_init()".

      Upon crashing, the application will output: 

      terminate called after throwing an instance of 'std::bad_alloc'
      {{ what(): std::bad_alloc}}

       Stack trace from GDB  ]is attached.

       

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            daveriesz Dave Riesz
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes