re PR target/77991 (ICE on x32 in plus_constant, at explow.c:87)
authorUros Bizjak <uros@gcc.gnu.org>
Tue, 18 Oct 2016 14:39:39 +0000 (16:39 +0200)
committerUros Bizjak <uros@gcc.gnu.org>
Tue, 18 Oct 2016 14:39:39 +0000 (16:39 +0200)
PR target/77991
* config/i386/i386.c (legitimize_tls_address)
<case TLS_MODEL_INITIAL_EXEC>: 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
gcc/config/i386/i386.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr77991.c [new file with mode: 0644]

index 2ce7f479a0971bc6dac24491bfba6ab21915dfae..5fc85caaf7d45e337f4375241bc64ead326bf7ef 100644 (file)
@@ -1,3 +1,10 @@
+2016-10-18  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR target/77991
+       * config/i386/i386.c (legitimize_tls_address)
+       <case TLS_MODEL_INITIAL_EXEC>: For TARGET_64BIT || TARGET_ANY_GNU_TLS
+       convert dest to Pmode if different than Pmode.
+
 2016-10-18  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
        PR tree-optimization/77916
index bafbe75b628288a5aa265fc3d253cdb717a9f36d..5cac21d41418e515e9d91b5448589a8445b1a6d0 100644 (file)
@@ -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
        {
index b1d6cb7c6347ab8be8edde6448b75e6af81ce7b3..8e878821f107184f0889d36183af2a730c155b70 100644 (file)
@@ -1,3 +1,8 @@
+2016-10-18  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR target/77991
+       * gcc.target/i386/pr77991.c: New test.
+
 2016-10-18  Matthew Fortune  <matthew.fortune@imgtec.com>
 
        * lib/gcc-dg.exp: Set gcc_force_conventional_output whenever
@@ -5,8 +10,7 @@
 
 2016-10-18  Senthil Kumar Selvaraj  <senthil_kumar.selvaraj@atmel.com>
 
-       * 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  <rguenther@suse.de>
 
        * 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  <msebor@redhat.com>
 
        * gcc.dg/torture/pr77855.c: New testcase.
 
 2016-10-06  James Clarke  <jrtc27@jrtc27.com>
-            Eric Botcazou  <ebotcazou@adacore.com>
+           Eric Botcazou  <ebotcazou@adacore.com>
 
        * 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 (file)
index 0000000..6784fbc
--- /dev/null
@@ -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);
+}