From 76dd203e1b51267cbb227a5e2ffab5f20a56f62d Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Wed, 22 Feb 2017 15:00:39 +0000 Subject: [PATCH] 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 --- gcc/ChangeLog | 8 ++++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/i386/pr79673.c | 12 ++++++++++++ gcc/tree-ssa-pre.c | 16 ++++++++-------- 4 files changed, 33 insertions(+), 8 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr79673.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index aa7a1cf..d920b6b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,13 @@ 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 * tree-vrp.c (extract_range_from_binary_expr_1): Make sure to not symbolically negate if that may introduce undefined diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index af56482..5ba7d83 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 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 * gcc.dg/torture/pr79666.c: New testcase. diff --git a/gcc/testsuite/gcc.target/i386/pr79673.c b/gcc/testsuite/gcc.target/i386/pr79673.c new file mode 100644 index 0000000..2ca667b --- /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 681c412..7fce0d3 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 (); -- 2.7.4