From 260555278b749d14abf4eea926d88cfe7f235b6b Mon Sep 17 00:00:00 2001 From: rguenth Date: Tue, 5 Jun 2018 10:02:50 +0000 Subject: [PATCH] 2018-06-05 Richard Biener PR tree-optimization/86046 * tree-ssa.c (maybe_optimize_var): Clear DECL_GIMPLE_REG_P if required after clearing TREE_ADDRESSABLE. * gcc.dg/pr86046.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@261193 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr86046.c | 8 ++++++++ gcc/tree-ssa.c | 6 ++++++ 4 files changed, 25 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr86046.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f67d2bbb892..b4a63fd25a4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2018-06-05 Richard Biener + PR tree-optimization/86046 + * tree-ssa.c (maybe_optimize_var): Clear DECL_GIMPLE_REG_P + if required after clearing TREE_ADDRESSABLE. + +2018-06-05 Richard Biener + PR tree-optimization/86047 * tree-ssa-loop.c (for_each_index): Glob handling of all decls and constants and really handle all of them. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1ad08c6e34c..2cacaa2931d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2018-06-05 Richard Biener + PR tree-optimization/86046 + * gcc.dg/pr86046.c: New testcase. + +2018-06-05 Richard Biener + PR tree-optimization/86047 * gcc.dg/pr86047.c: New testcase. diff --git a/gcc/testsuite/gcc.dg/pr86046.c b/gcc/testsuite/gcc.dg/pr86046.c new file mode 100644 index 00000000000..6d4c948cf8a --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr86046.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +typedef int V __attribute__ ((vector_size(4))); +void fn1 () +{ + (V){(1,0)}[1] = 0; // out-of-bound access +} diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index d197f99bdd2..f1b322f2de6 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -1565,6 +1565,12 @@ maybe_optimize_var (tree var, bitmap addresses_taken, bitmap not_reg_needs, || !bitmap_bit_p (not_reg_needs, DECL_UID (var)))) { TREE_ADDRESSABLE (var) = 0; + /* If we cleared TREE_ADDRESSABLE make sure DECL_GIMPLE_REG_P + is unset if we cannot rewrite the var into SSA. */ + if ((TREE_CODE (TREE_TYPE (var)) == VECTOR_TYPE + || TREE_CODE (TREE_TYPE (var)) == COMPLEX_TYPE) + && bitmap_bit_p (not_reg_needs, DECL_UID (var))) + DECL_GIMPLE_REG_P (var) = 0; if (is_gimple_reg (var)) bitmap_set_bit (suitable_for_renaming, DECL_UID (var)); if (dump_file) -- 2.11.4.GIT