Details
-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
5.9.0
-
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.