From 5cb96b6a87ec58038803fd093974e383483ed76e Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Tue, 18 Oct 2016 16:39:39 +0200 Subject: [PATCH] re PR target/77991 (ICE on x32 in plus_constant, at explow.c:87) PR target/77991 * config/i386/i386.c (legitimize_tls_address) : For TARGET_64BIT || TARGET_ANY_GNU_TLS convert dest to Pmode if different than Pmode. testsuite/ChangeLog: PR target/77991 * gcc.target/i386/pr77991.c: New test. From-SVN: r241308 --- gcc/ChangeLog | 7 +++++++ gcc/config/i386/i386.c | 4 +++- gcc/testsuite/ChangeLog | 14 +++++++++----- gcc/testsuite/gcc.target/i386/pr77991.c | 19 +++++++++++++++++++ 4 files changed, 38 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr77991.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2ce7f479a09..5fc85caaf7d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2016-10-18 Uros Bizjak + + PR target/77991 + * config/i386/i386.c (legitimize_tls_address) + : For TARGET_64BIT || TARGET_ANY_GNU_TLS + convert dest to Pmode if different than Pmode. + 2016-10-18 Bill Schmidt PR tree-optimization/77916 diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index bafbe75b628..5cac21d4141 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -16357,7 +16357,9 @@ legitimize_tls_address (rtx x, enum tls_model model, bool for_mov) base = get_thread_pointer (tp_mode, for_mov || !TARGET_TLS_DIRECT_SEG_REFS); off = force_reg (tp_mode, off); - return gen_rtx_PLUS (tp_mode, base, off); + dest = gen_rtx_PLUS (tp_mode, base, off); + if (tp_mode != Pmode) + dest = convert_to_mode (Pmode, dest, 1); } else { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b1d6cb7c634..8e878821f10 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-10-18 Uros Bizjak + + PR target/77991 + * gcc.target/i386/pr77991.c: New test. + 2016-10-18 Matthew Fortune * lib/gcc-dg.exp: Set gcc_force_conventional_output whenever @@ -5,8 +10,7 @@ 2016-10-18 Senthil Kumar Selvaraj - * gcc.dg/sso/sso.exp: Return early if not - effective_target_int32. + * gcc.dg/sso/sso.exp: Return early if not effective_target_int32. 2016-10-18 Richard Biener @@ -228,8 +232,8 @@ * g++.dg/ext/flexary18.C: New test. * g++.dg/torture/pr64312.C: Add a dg-error directive to an ill-formed regression test. - * g++.dg/compat/struct-layout-1_generate.c (subfield): Add argument. - Avoid generating a flexible array member in an array. + * g++.dg/compat/struct-layout-1_generate.c (subfield): Add argument. + Avoid generating a flexible array member in an array. 2016-10-13 Martin Sebor @@ -706,7 +710,7 @@ * gcc.dg/torture/pr77855.c: New testcase. 2016-10-06 James Clarke - Eric Botcazou + Eric Botcazou * g++.dg/other/pr77759.C: New test. diff --git a/gcc/testsuite/gcc.target/i386/pr77991.c b/gcc/testsuite/gcc.target/i386/pr77991.c new file mode 100644 index 00000000000..6784fbcb9fb --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr77991.c @@ -0,0 +1,19 @@ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-require-effective-target maybe_x32 } */ +/* { dg-options "-O2 -mx32 -maddress-mode=short" } */ + +struct rcu_reader_data +{ + unsigned ctr; + _Bool waiting; +} + +extern __thread rcu_reader; + +void rcu_read_lock() +{ + struct rcu_reader_data *x = &rcu_reader; + _Bool val = 0; + + __atomic_store(&x->waiting, &val, 0); +} -- 2.30.2