aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-qt/qt5/qtdeclarative/0003-Workaround-crashes-in-QtQml-code-related-to-dead-sto.patch
blob: d3ee42ef7900c4a76d592f75ea941ea1e38a2c98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
From fcc2c95421710f98c7b2dec73e2c8b0d9164bc9b Mon Sep 17 00:00:00 2001
From: Jonathan Liu <net147@gmail.com>
Date: Wed, 24 Aug 2016 11:18:37 +1000
Subject: [PATCH] Workaround crashes in QtQml code related to dead-store
 elimination

When compiled in release mode with GCC 6, QtQml may crash.
This is because the C++ compiler is more aggressive about dead-store
elimination in situations where a memory store to a location precedes
the construction of an object at that memory location.

The QV4::MemoryManager::allocate{Managed,Object} functions allocate
memory and write to it before the caller does a placement new to
construct an object in the same memory. The compiler considers these
writes before the constructor as "dead stores" and eliminates them.

The -fno-lifetime-dse compiler flag is added to disable this more
aggressive dead-store eliminiation optimization.

This is a temporary workaround until a proper solution is found.

Upstream-Status: Accepted

Task-number: QTBUG-55482
Change-Id: I7dbae6e9e613e53ce5fb25957c449bc6657803b5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Signed-off-by: Jonathan Liu <net147@gmail.com>
---
 src/qml/qml.pro | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/qml/qml.pro b/src/qml/qml.pro
index f4862a1..651afa6 100644
--- a/src/qml/qml.pro
+++ b/src/qml/qml.pro
@@ -18,7 +18,7 @@ exists("qqml_enable_gcov") {
 
 greaterThan(QT_GCC_MAJOR_VERSION, 5) {
     # Our code is bad. Temporary workaround.
-    QMAKE_CXXFLAGS += -fno-delete-null-pointer-checks
+    QMAKE_CXXFLAGS += -fno-delete-null-pointer-checks -fno-lifetime-dse
 }
 
 QMAKE_DOCS = $$PWD/doc/qtqml.qdocconf