re PR c/86046 (ICE in execute_todo, at passes.c:2043)
authorRichard Biener <rguenther@suse.de>
Tue, 5 Jun 2018 10:02:50 +0000 (10:02 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 5 Jun 2018 10:02:50 +0000 (10:02 +0000)
2018-06-05  Richard Biener  <rguenther@suse.de>

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.

From-SVN: r261193

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr86046.c [new file with mode: 0644]
gcc/tree-ssa.c

index f67d2bbb8926090141b58e574fb61f06281f9d5f..b4a63fd25a4cbeb46ac3b546905687f654e834d7 100644 (file)
@@ -1,3 +1,9 @@
+2018-06-05  Richard Biener  <rguenther@suse.de>
+
+       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  <rguenther@suse.de>
 
        PR tree-optimization/86047
index 1ad08c6e34cefc0eeccf41753a3da747b4f4ed63..2cacaa2931de1cce6b65ba4a7372f99cea68dc97 100644 (file)
@@ -1,3 +1,8 @@
+2018-06-05  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/86046
+       * gcc.dg/pr86046.c: New testcase.
+
 2018-06-05  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/86047
diff --git a/gcc/testsuite/gcc.dg/pr86046.c b/gcc/testsuite/gcc.dg/pr86046.c
new file mode 100644 (file)
index 0000000..6d4c948
--- /dev/null
@@ -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
+}
index d197f99bdd231e0e7a1eab12b158920150596834..f1b322f2de68e4bb618f747f9a090c3c7249387b 100644 (file)
@@ -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)