re PR tree-optimization/90856 (ICE: verify_gimple failed (error: incompatible types...
authorRichard Biener <rguenther@suse.de>
Thu, 13 Jun 2019 13:03:13 +0000 (13:03 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 13 Jun 2019 13:03:13 +0000 (13:03 +0000)
2019-06-13  Richard Biener  <rguenther@suse.de>

PR tree-optimization/90856
* tree-sra.c (build_ref_for_model): Only use
build_reconstructed_reference when address-spaces are the same.

* gcc.target/i386/pr90856.c: New testcase.

From-SVN: r272244

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr90856.c [new file with mode: 0644]
gcc/tree-sra.c

index b8eba5e1c484b95fd3dc35a314e8722de7038b32..685c06d76b857d289d408548b47c1e77cb7096d6 100644 (file)
@@ -1,3 +1,9 @@
+2019-06-13  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/90856
+       * tree-sra.c (build_ref_for_model): Only use
+       build_reconstructed_reference when address-spaces are the same.
+
 2019-06-13  Jakub Jelinek  <jakub@redhat.com>
 
        * config/nvptx/nvptx.c (nvptx_sese_number, nvptx_sese_pseudo): Don't
index 5dbfc35df03fe84cd8b6694ba7164974cc1b3b6c..b1d8ecc6465eb95346870659c177b0f85f438942 100644 (file)
@@ -1,3 +1,8 @@
+2019-06-13  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/90856
+       * gcc.target/i386/pr90856.c: New testcase.
+
 2019-06-13  Jakub Jelinek  <jakub@redhat.com>
 
        * g++.dg/tree-ssa/ssa-dse-1.C: Don't match exact number of chars of
diff --git a/gcc/testsuite/gcc.target/i386/pr90856.c b/gcc/testsuite/gcc.target/i386/pr90856.c
new file mode 100644 (file)
index 0000000..a9a909b
--- /dev/null
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+typedef struct { int v; } S1;
+typedef struct { S1 s1[32]; } S2;
+
+S1 clearS1() { S1 s; s.v = 1; return s; }
+
+void
+clearS2(__seg_gs S2 *p, int n)
+{
+  for (int i = 0; i < n; ++i)
+    p->s1[i] = clearS1();
+}
index 074d49643793ba3f5c40e843537b5307b75e9d3c..03c1a2ae9e91669bea57233597c374f8e8ff55af 100644 (file)
@@ -1854,6 +1854,8 @@ build_ref_for_model (location_t loc, tree base, HOST_WIDE_INT offset,
       tree res;
       if (model->grp_same_access_path
          && !TREE_THIS_VOLATILE (base)
+         && (TYPE_ADDR_SPACE (TREE_TYPE (base))
+             == TYPE_ADDR_SPACE (TREE_TYPE (model->expr)))
          && offset <= model->offset
          /* build_reconstructed_reference can still fail if we have already
             massaged BASE because of another type incompatibility.  */