This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH 3/3] PR jit/64810: fix for arm_option_override
- From: David Malcolm <dmalcolm at redhat dot com>
- To: jit at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org, Ramana Radhakrishnan <ramana dot radhakrishnan at arm dot com>
- Cc: David Malcolm <dmalcolm at redhat dot com>
- Date: Fri, 30 Jan 2015 06:11:41 -0500
- Subject: [PATCH 3/3] PR jit/64810: fix for arm_option_override
- Authentication-results: sourceware.org; auth=none
- References: <1422616184-38258-1-git-send-email-dmalcolm at redhat dot com>
libgccjit can make repeated in-process calls to the compiler code.
On arm I see failures where e.g. the top of the generated .s file has:
on the 1st iteration:
.arch armv7-a
on the 2nd iteration:
.cpu armv7-a
without changing any options.
What's happening is the 1st time through arm_option_override,
arm_selected_cpu is NULL, but is set to non-NULL at:
arm_selected_cpu = arm_selected_arch;
The 2nd time through, arm_selected_cpu hasn't been reset, and so the
condition:
if (arm_selected_arch)
{
if (arm_selected_cpu)
{
/* Check for conflict between mcpu and march. */
fires, and this clause fires:
/* -mcpu wins. */
arm_selected_arch = NULL;
so we have a NULL arm_selected_arch and a non-NULL arm_selected_cpu.
The fix is to reset arm-specific state, setting
arm_selected_{arch|cpu|tune}
to NULL at the top of arm_option_override, to prevent state from
previous in-process runs from affecting things.
With this, and the previous patches, most of the jit testsuite passes
on arm, with the only remaining failures being of the form:
WARNING: Timed out executing test case
on the very large test cases (test-combination.c and test-threads.c).
OK for stage 4?
gcc/ChangeLog:
PR jit/64810
* config/arm/arm.c (arm_option_override): Set
arm_selected_arch/cpu/tune to NULL on entry.
---
gcc/config/arm/arm.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 246298a..c7c0ecf 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -2627,6 +2627,10 @@ arm_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
static void
arm_option_override (void)
{
+ arm_selected_arch = NULL;
+ arm_selected_cpu = NULL;
+ arm_selected_tune = NULL;
+
if (global_options_set.x_arm_arch_option)
arm_selected_arch = &all_architectures[arm_arch_option];
--
1.8.5.3