re PR middle-end/79673 (GIMPLE verification fails when compiling code with __seg_gs)
authorRichard Biener <rguenther@suse.de>
Wed, 22 Feb 2017 15:00:39 +0000 (15:00 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 22 Feb 2017 15:00:39 +0000 (15:00 +0000)
2017-02-22  Richard Biener  <rguenther@suse.de>

PR tree-optimization/79673
* tree-ssa-pre.c (compute_avail): Use wide_int_to_tree to
convert the [TARGET_]MEM_REF offset INTEGER_CST, scrapping off
irrelevant address-space qualifiers and avoiding a
ADDR_SPACE_CONVERT_EXPR from fold_convert.

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

From-SVN: r245649

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr79673.c [new file with mode: 0644]
gcc/tree-ssa-pre.c

index aa7a1cfc7e32f4b3730201c0c2244eb8ea995874..d920b6b5f8fac0ba375185cf5de283ef9999944d 100644 (file)
@@ -1,3 +1,11 @@
+2017-02-22  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/79673
+       * tree-ssa-pre.c (compute_avail): Use wide_int_to_tree to
+       convert the [TARGET_]MEM_REF offset INTEGER_CST, scrapping off
+       irrelevant address-space qualifiers and avoiding a
+       ADDR_SPACE_CONVERT_EXPR from fold_convert.
+
 2017-02-22  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/79666
index af56482b5afbf924fb31b179004a136cb4437915..5ba7d83d28018afb5516ab10dadeada18f55e8d8 100644 (file)
@@ -1,3 +1,8 @@
+2017-02-22  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/79673
+       * gcc.target/i386/pr79673.c: New testcase.
+
 2017-02-22  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/79666
diff --git a/gcc/testsuite/gcc.target/i386/pr79673.c b/gcc/testsuite/gcc.target/i386/pr79673.c
new file mode 100644 (file)
index 0000000..2ca667b
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+void used(double x);
+void usel(long x);
+void test(int c)
+{
+  if (c)
+    used(*((double __seg_gs *) 0));
+  else
+    usel(*((long __seg_gs *) 0));
+}
index 681c412d130e6c03106b0f88b7d69ea453a7f218..7fce0d3bcfbb98127d65978ccd79b1647e61b6a6 100644 (file)
@@ -3986,21 +3986,21 @@ compute_avail (void)
                        {
                          ref->set = set;
                          if (ref1->opcode == MEM_REF)
-                           ref1->op0 = fold_convert (TREE_TYPE (ref2->op0),
-                                                     ref1->op0);
+                           ref1->op0 = wide_int_to_tree (TREE_TYPE (ref2->op0),
+                                                         ref1->op0);
                          else
-                           ref1->op2 = fold_convert (TREE_TYPE (ref2->op2),
-                                                     ref1->op2);
+                           ref1->op2 = wide_int_to_tree (TREE_TYPE (ref2->op2),
+                                                         ref1->op2);
                        }
                      else
                        {
                          ref->set = 0;
                          if (ref1->opcode == MEM_REF)
-                           ref1->op0 = fold_convert (ptr_type_node,
-                                                     ref1->op0);
+                           ref1->op0 = wide_int_to_tree (ptr_type_node,
+                                                         ref1->op0);
                          else
-                           ref1->op2 = fold_convert (ptr_type_node,
-                                                     ref1->op2);
+                           ref1->op2 = wide_int_to_tree (ptr_type_node,
+                                                         ref1->op2);
                        }
                      operands.release ();