summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Baryshkov <dmitry.baryshkov@linaro.org>2020-07-17 01:36:35 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-07-22 23:47:57 +0100
commit48cd01d208712151ba3cf2760ae7b6b4ea5bddf3 (patch)
treeb6b9bcfb9ebbc81f7da922ece9407243978b87a2
parent4ad6e1182e1b2d1b0047e250fc3596c66aa3f85e (diff)
downloadpoky-48cd01d208712151ba3cf2760ae7b6b4ea5bddf3.tar.gz
gcc-10.1: add fix for PR 96130
Fix for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96130 causing ICE (SegFault) when compiling current Mesa git tree. (From OE-Core rev: bc2f2e72f20e6b272e48d1073bb2290665cbde24) Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-devtools/gcc/gcc-10.1.inc1
-rw-r--r--meta/recipes-devtools/gcc/gcc-10.1/pr96130.patch106
2 files changed, 107 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-10.1.inc b/meta/recipes-devtools/gcc/gcc-10.1.inc
index 7c1201a2e3..5f310301b0 100644
--- a/meta/recipes-devtools/gcc/gcc-10.1.inc
+++ b/meta/recipes-devtools/gcc/gcc-10.1.inc
@@ -69,6 +69,7 @@ SRC_URI = "\
69 file://0001-aarch64-New-Straight-Line-Speculation-SLS-mitigation.patch \ 69 file://0001-aarch64-New-Straight-Line-Speculation-SLS-mitigation.patch \
70 file://0002-aarch64-Introduce-SLS-mitigation-for-RET-and-BR-inst.patch \ 70 file://0002-aarch64-Introduce-SLS-mitigation-for-RET-and-BR-inst.patch \
71 file://0003-aarch64-Mitigate-SLS-for-BLR-instruction.patch \ 71 file://0003-aarch64-Mitigate-SLS-for-BLR-instruction.patch \
72 file://pr96130.patch \
72" 73"
73SRC_URI[sha256sum] = "b6898a23844b656f1b68691c5c012036c2e694ac4b53a8918d4712ad876e7ea2" 74SRC_URI[sha256sum] = "b6898a23844b656f1b68691c5c012036c2e694ac4b53a8918d4712ad876e7ea2"
74 75
diff --git a/meta/recipes-devtools/gcc/gcc-10.1/pr96130.patch b/meta/recipes-devtools/gcc/gcc-10.1/pr96130.patch
new file mode 100644
index 0000000000..f0e6f85e22
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-10.1/pr96130.patch
@@ -0,0 +1,106 @@
1From 0d03c0ee5213703ec6d9ffa632fa5298d83adaaa Mon Sep 17 00:00:00 2001
2From: Jakub Jelinek <jakub@redhat.com>
3Date: Mon, 13 Jul 2020 18:25:53 +0200
4Subject: [PATCH] ipa-fnsummary: Fix ICE with switch predicates [PR96130]
5
6The following testcase ICEs since r10-3199.
7There is a switch with default label, where the controlling expression has
8range just 0..7 and there are case labels for all those 8 values, but
9nothing has yet optimized away the default.
10Since r10-3199, set_switch_stmt_execution_predicate sets the switch to
11default label's edge's predicate to a false predicate and then
12compute_bb_predicates propagates the predicates through the cfg, but false
13predicates aren't really added. The caller of compute_bb_predicates
14in one place handles NULL bb->aux as false predicate:
15 if (fbi.info)
16 {
17 if (bb->aux)
18 bb_predicate = *(predicate *) bb->aux;
19 else
20 bb_predicate = false;
21 }
22 else
23 bb_predicate = true;
24but then in two further spots that the patch below is changing
25it assumes bb->aux must be non-NULL. Those two spots are guarded by a
26condition that is only true if fbi.info is non-NULL, so I think the right
27fix is to treat NULL aux as false predicate in those spots too.
28
292020-07-13 Jakub Jelinek <jakub@redhat.com>
30
31 PR ipa/96130
32 * ipa-fnsummary.c (analyze_function_body): Treat NULL bb->aux
33 as false predicate.
34
35 * gcc.dg/torture/pr96130.c: New test.
36
37(cherry picked from commit 776e48e0931db69f158f40e5cb8e15463d879a42)
38---
39 gcc/ipa-fnsummary.c | 10 ++++++++--
40 gcc/testsuite/gcc.dg/torture/pr96130.c | 26 ++++++++++++++++++++++++++
41 2 files changed, 34 insertions(+), 2 deletions(-)
42 create mode 100644 gcc/testsuite/gcc.dg/torture/pr96130.c
43
44diff --git a/gcc/ipa-fnsummary.c b/gcc/ipa-fnsummary.c
45index 045a0ecf766..55a0b272a96 100644
46--- a/gcc/ipa-fnsummary.c
47+++ b/gcc/ipa-fnsummary.c
48@@ -2766,7 +2766,10 @@ analyze_function_body (struct cgraph_node *node, bool early)
49 edge ex;
50 unsigned int j;
51 class tree_niter_desc niter_desc;
52- bb_predicate = *(predicate *) loop->header->aux;
53+ if (loop->header->aux)
54+ bb_predicate = *(predicate *) loop->header->aux;
55+ else
56+ bb_predicate = false;
57
58 exits = get_loop_exit_edges (loop);
59 FOR_EACH_VEC_ELT (exits, j, ex)
60@@ -2799,7 +2802,10 @@ analyze_function_body (struct cgraph_node *node, bool early)
61 for (unsigned i = 0; i < loop->num_nodes; i++)
62 {
63 gimple_stmt_iterator gsi;
64- bb_predicate = *(predicate *) body[i]->aux;
65+ if (body[i]->aux)
66+ bb_predicate = *(predicate *) body[i]->aux;
67+ else
68+ bb_predicate = false;
69 for (gsi = gsi_start_bb (body[i]); !gsi_end_p (gsi);
70 gsi_next (&gsi))
71 {
72diff --git a/gcc/testsuite/gcc.dg/torture/pr96130.c b/gcc/testsuite/gcc.dg/torture/pr96130.c
73new file mode 100644
74index 00000000000..f722b9ad2a9
75--- /dev/null
76+++ b/gcc/testsuite/gcc.dg/torture/pr96130.c
77@@ -0,0 +1,26 @@
78+/* PR ipa/96130 */
79+/* { dg-do compile } */
80+
81+struct S { unsigned j : 3; };
82+int k, l, m;
83+
84+void
85+foo (struct S x)
86+{
87+ while (l != 5)
88+ switch (x.j)
89+ {
90+ case 1:
91+ case 3:
92+ case 4:
93+ case 6:
94+ case 2:
95+ case 5:
96+ l = m;
97+ case 7:
98+ case 0:
99+ k = 0;
100+ default:
101+ break;
102+ }
103+}
104--
1052.18.4
106