Gentoo Archives: gentoo-commits

From: Sergei Trofimovich <slyfox@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/gcc-patches:master commit in: 11.1.0/gentoo/
Date: Sat, 29 May 2021 09:24:03
Message-Id: 1622280153.f0adcd768cd9ceea562a91795774f2453e2da9b9.slyfox@gentoo
1 commit: f0adcd768cd9ceea562a91795774f2453e2da9b9
2 Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
3 AuthorDate: Sat May 29 09:22:33 2021 +0000
4 Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
5 CommitDate: Sat May 29 09:22:33 2021 +0000
6 URL: https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=f0adcd76
7
8 11.1.0: backport PR100767: fix ICE on arm -flto march mix
9
10 Reported-by: Gabriel Marcano
11 Bug: https://bugs.gentoo.org/792291
12 Bug: https://gcc.gnu.org/PR100767
13 Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
14
15 11.1.0/gentoo/30_all_arm-lto-ICE-march-mix.patch | 153 +++++++++++++++++++++++
16 11.1.0/gentoo/README.history | 1 +
17 2 files changed, 154 insertions(+)
18
19 diff --git a/11.1.0/gentoo/30_all_arm-lto-ICE-march-mix.patch b/11.1.0/gentoo/30_all_arm-lto-ICE-march-mix.patch
20 new file mode 100644
21 index 0000000..c19e3fa
22 --- /dev/null
23 +++ b/11.1.0/gentoo/30_all_arm-lto-ICE-march-mix.patch
24 @@ -0,0 +1,153 @@
25 +https://gcc.gnu.org/PR100767
26 +https://bugs.gentoo.org/792291
27 +
28 +From 0faee8bae391fab7e1ba4a494360dd9793e15fb5 Mon Sep 17 00:00:00 2001
29 +From: Richard Earnshaw <rearnsha@×××.com>
30 +Date: Thu, 27 May 2021 10:25:37 +0100
31 +Subject: [PATCH] arm: Remove use of opts_set in arm_configure_build_target
32 + [PR100767]
33 +
34 +The variable global_options_set is a reflection of which options have
35 +been explicitly set from the command line in the structure
36 +global_options. But it doesn't describe the contents of a
37 +cl_target_option. cl_target_option is a set of options to apply and
38 +once configured should represent a viable set of options without
39 +needing to know which were explicitly set by the user.
40 +
41 +Unfortunately arm_configure_build_target was incorrectly conflating
42 +the two. Fortunately, however, we do not really need to know this
43 +since the various override_options functions should have sanitized the
44 +target_options values before constructing a cl_target_option
45 +structure. It is safe, therefore, to simply drop this parameter to
46 +arm_configure_build_target and rely on checking that various string
47 +parameters are non-null before dereferencing them.
48 +
49 +gcc:
50 +
51 + PR target/100767
52 + * config/arm/arm.c (arm_configure_build_target): Remove parameter
53 + opts_set, directly check opts parameters for being non-null.
54 + (arm_option_restore): Update call to arm_configure_build_target.
55 + (arm_option_override): Likewise.
56 + (arm_can_inline_p): Likewise.
57 + (arm_valid_target_attribute_tree): Likewise.
58 + * config/arm/arm-c.c (arm_pragma_target_parse): Likewise.
59 + * config/arm/arm-protos.h (arm_configure_build_target): Adjust
60 + prototype.
61 +
62 +(cherry picked from commit 262e75d22c350acbdf4c1fb4f224cc5d3d711eff)
63 +---
64 + gcc/config/arm/arm-c.c | 3 +--
65 + gcc/config/arm/arm-protos.h | 3 +--
66 + gcc/config/arm/arm.c | 23 ++++++++++-------------
67 + 3 files changed, 12 insertions(+), 17 deletions(-)
68 +
69 +--- a/gcc/config/arm/arm-c.c
70 ++++ b/gcc/config/arm/arm-c.c
71 +@@ -408,8 +408,7 @@ arm_pragma_target_parse (tree args, tree pop_target)
72 + target_option_current_node, but not handle_pragma_target. */
73 + target_option_current_node = cur_tree;
74 + arm_configure_build_target (&arm_active_target,
75 +- TREE_TARGET_OPTION (cur_tree),
76 +- &global_options_set, false);
77 ++ TREE_TARGET_OPTION (cur_tree), false);
78 + }
79 +
80 + /* Update macros if target_node changes. The global state will be restored
81 +--- a/gcc/config/arm/arm-protos.h
82 ++++ b/gcc/config/arm/arm-protos.h
83 +@@ -243,8 +243,7 @@ extern bool arm_change_mode_p (tree);
84 + extern tree arm_valid_target_attribute_tree (tree, struct gcc_options *,
85 + struct gcc_options *);
86 + extern void arm_configure_build_target (struct arm_build_target *,
87 +- struct cl_target_option *,
88 +- struct gcc_options *, bool);
89 ++ struct cl_target_option *, bool);
90 + extern void arm_option_reconfigure_globals (void);
91 + extern void arm_options_perform_arch_sanity_checks (void);
92 + extern void arm_pr_long_calls (struct cpp_reader *);
93 +--- a/gcc/config/arm/arm.c
94 ++++ b/gcc/config/arm/arm.c
95 +@@ -3052,9 +3052,10 @@ arm_override_options_after_change (void)
96 + /* Implement TARGET_OPTION_RESTORE. */
97 + static void
98 + arm_option_restore (struct gcc_options */* opts */,
99 +- struct gcc_options *opts_set, struct cl_target_option *ptr)
100 ++ struct gcc_options */* opts_set */,
101 ++ struct cl_target_option *ptr)
102 + {
103 +- arm_configure_build_target (&arm_active_target, ptr, opts_set, false);
104 ++ arm_configure_build_target (&arm_active_target, ptr, false);
105 + }
106 +
107 + /* Reset options between modes that the user has specified. */
108 +@@ -3177,7 +3178,6 @@ static sbitmap isa_quirkbits;
109 + void
110 + arm_configure_build_target (struct arm_build_target *target,
111 + struct cl_target_option *opts,
112 +- struct gcc_options *opts_set,
113 + bool warn_compatible)
114 + {
115 + const cpu_option *arm_selected_tune = NULL;
116 +@@ -3192,7 +3192,7 @@ arm_configure_build_target (struct arm_build_target *target,
117 + target->core_name = NULL;
118 + target->arch_name = NULL;
119 +
120 +- if (opts_set->x_arm_arch_string)
121 ++ if (opts->x_arm_arch_string)
122 + {
123 + arm_selected_arch = arm_parse_arch_option_name (all_architectures,
124 + "-march",
125 +@@ -3200,7 +3200,7 @@ arm_configure_build_target (struct arm_build_target *target,
126 + arch_opts = strchr (opts->x_arm_arch_string, '+');
127 + }
128 +
129 +- if (opts_set->x_arm_cpu_string)
130 ++ if (opts->x_arm_cpu_string)
131 + {
132 + arm_selected_cpu = arm_parse_cpu_option_name (all_cores, "-mcpu",
133 + opts->x_arm_cpu_string);
134 +@@ -3210,7 +3210,7 @@ arm_configure_build_target (struct arm_build_target *target,
135 + options for tuning. */
136 + }
137 +
138 +- if (opts_set->x_arm_tune_string)
139 ++ if (opts->x_arm_tune_string)
140 + {
141 + arm_selected_tune = arm_parse_cpu_option_name (all_cores, "-mtune",
142 + opts->x_arm_tune_string);
143 +@@ -3474,8 +3474,7 @@ arm_option_override (void)
144 + }
145 +
146 + cl_target_option_save (&opts, &global_options, &global_options_set);
147 +- arm_configure_build_target (&arm_active_target, &opts, &global_options_set,
148 +- true);
149 ++ arm_configure_build_target (&arm_active_target, &opts, true);
150 +
151 + #ifdef SUBTARGET_OVERRIDE_OPTIONS
152 + SUBTARGET_OVERRIDE_OPTIONS;
153 +@@ -32857,10 +32856,8 @@ arm_can_inline_p (tree caller, tree callee)
154 + caller_target.isa = sbitmap_alloc (isa_num_bits);
155 + callee_target.isa = sbitmap_alloc (isa_num_bits);
156 +
157 +- arm_configure_build_target (&caller_target, caller_opts, &global_options_set,
158 +- false);
159 +- arm_configure_build_target (&callee_target, callee_opts, &global_options_set,
160 +- false);
161 ++ arm_configure_build_target (&caller_target, caller_opts, false);
162 ++ arm_configure_build_target (&callee_target, callee_opts, false);
163 + if (!bitmap_subset_p (callee_target.isa, caller_target.isa))
164 + can_inline = false;
165 +
166 +@@ -32996,7 +32993,7 @@ arm_valid_target_attribute_tree (tree args, struct gcc_options *opts,
167 + return NULL_TREE;
168 +
169 + cl_target_option_save (&cl_opts, opts, opts_set);
170 +- arm_configure_build_target (&arm_active_target, &cl_opts, opts_set, false);
171 ++ arm_configure_build_target (&arm_active_target, &cl_opts, false);
172 + arm_option_check_internal (opts);
173 + /* Do any overrides, such as global options arch=xxx.
174 + We do this since arm_active_target was overridden. */
175 +--
176 +2.31.1
177 +
178
179 diff --git a/11.1.0/gentoo/README.history b/11.1.0/gentoo/README.history
180 index 00f2ee7..504c233 100644
181 --- a/11.1.0/gentoo/README.history
182 +++ b/11.1.0/gentoo/README.history
183 @@ -2,6 +2,7 @@
184 + 27_all_msp430-f2c.patch
185 + 28_all_ctor-union-PR100489.patch
186 + 29_all_perfect-implicit-PR100644.patch
187 + + 30_all_arm-lto-ICE-march-mix.patch
188
189 1 27 Apr 2021
190 + 01_all_default-fortify-source.patch