summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMikhail Svetkin <mikhail.svetkin@qt.io>2018-07-16 16:18:05 +0200
committerMikhail Svetkin <mikhail.svetkin@qt.io>2018-07-18 08:26:32 +0000
commit0826aeddd27bf679a0f16799efc69288058edeaf (patch)
tree186c9f14322b10b8ecc8d7b6368d3515d7c42eb1 /src
parentcc5d8168001e652c045ff42685edf257ce00603c (diff)
qlibrary_unix: work around compile bug in gcc5.4
GCC5.4 generates incorrect code. The QString object which is passed by value to f-lambda, has been corrupted by the time this lambda returns. Accessing this object causes memory corruption. The same can be reproduced with std::list and std::string Task-number: QTBUG-69394 Change-Id: I22522d2ddd1d5226de0aff378133d18391e370de Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/plugin/qlibrary_unix.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/corelib/plugin/qlibrary_unix.cpp b/src/corelib/plugin/qlibrary_unix.cpp
index 7ffd1369b9..851b9ff82f 100644
--- a/src/corelib/plugin/qlibrary_unix.cpp
+++ b/src/corelib/plugin/qlibrary_unix.cpp
@@ -182,21 +182,23 @@ bool QLibraryPrivate::load_sys()
#if defined(Q_PROCESSOR_X86) && !defined(Q_OS_DARWIN)
if (qCpuHasFeature(ArchHaswell)) {
- auto transform = [](QStringList &list, QString (*f)(QString)) {
+ auto transform = [](QStringList &list, void (*f)(QString *)) {
QStringList tmp;
qSwap(tmp, list);
list.reserve(tmp.size() * 2);
for (const QString &s : qAsConst(tmp)) {
- list.append(f(s));
+ QString modifiedPath = s;
+ f(&modifiedPath);
+ list.append(modifiedPath);
list.append(s);
}
};
if (pluginState == IsAPlugin) {
// add ".avx2" to each suffix in the list
- transform(suffixes, [](QString s) { return s.append(QLatin1String(".avx2")); });
+ transform(suffixes, [](QString *s) { s->append(QLatin1String(".avx2")); });
} else {
// prepend "haswell/" to each prefix in the list
- transform(prefixes, [](QString s) { return s.prepend(QLatin1String("haswell/")); });
+ transform(prefixes, [](QString *s) { s->prepend(QLatin1String("haswell/")); });
}
}
#endif