From: Richard Biener Date: Wed, 22 Feb 2017 15:00:39 +0000 (+0000) Subject: re PR middle-end/79673 (GIMPLE verification fails when compiling code with __seg_gs) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=76dd203e1b51267cbb227a5e2ffab5f20a56f62d;p=gcc.git re PR middle-end/79673 (GIMPLE verification fails when compiling code with __seg_gs) 2017-02-22 Richard Biener 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index aa7a1cfc7e3..d920b6b5f8f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2017-02-22 Richard Biener + + 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 PR tree-optimization/79666 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index af56482b5af..5ba7d83d280 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-02-22 Richard Biener + + PR tree-optimization/79673 + * gcc.target/i386/pr79673.c: New testcase. + 2017-02-22 Richard Biener 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 index 00000000000..2ca667bde4b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr79673.c @@ -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)); +} diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index 681c412d130..7fce0d3bcfb 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -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 ();