re PR tree-optimization/58006 (ICE compiling VegaStrike with -ffast-math -ftree-paral...
authorJakub Jelinek <jakub@redhat.com>
Sun, 18 Aug 2013 15:23:24 +0000 (17:23 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Sun, 18 Aug 2013 15:23:24 +0000 (17:23 +0200)
PR tree-optimization/58006
* tree-parloops.c (take_address_of): Don't ICE if get_name
returns NULL.
(eliminate_local_variables_stmt): Remove clobber stmts.

* g++.dg/opt/pr58006.C: New test.

From-SVN: r201827

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/opt/pr58006.C [new file with mode: 0644]
gcc/tree-parloops.c

index 8579567..9fdf2c4 100644 (file)
@@ -1,3 +1,10 @@
+2013-08-18  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/58006
+       * tree-parloops.c (take_address_of): Don't ICE if get_name
+       returns NULL.
+       (eliminate_local_variables_stmt): Remove clobber stmts.
+
 2013-08-18  Eric Botcazou  <ebotcazou@adacore.com>
 
        * cgraphunit.c (handle_alias_pairs): Reset the alias flag after the
index f734674..659ce71 100644 (file)
@@ -1,3 +1,8 @@
+2013-08-18  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/58006
+       * g++.dg/opt/pr58006.C: New test.
+
 2013-08-18  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gnat.dg/specs/linker_alias.ads: New test.
diff --git a/gcc/testsuite/g++.dg/opt/pr58006.C b/gcc/testsuite/g++.dg/opt/pr58006.C
new file mode 100644 (file)
index 0000000..fd3b7be
--- /dev/null
@@ -0,0 +1,22 @@
+// PR tree-optimization/58006
+// { dg-do compile }
+// { dg-require-effective-target pthread }
+// { dg-options "-Ofast -ftree-parallelize-loops=2" }
+
+extern "C" float sqrtf (float);
+
+struct S
+{
+  float i, j;
+  float foo () const { return sqrtf (i * i + j * j); }
+  S () : i (1), j (1) {}
+};
+
+void
+bar (int a, int b)
+{
+  int i;
+  float f;
+  for (i = a; i < b; i++)
+    f = S ().foo ();
+}
index cea6f03..0416745 100644 (file)
@@ -494,9 +494,12 @@ take_address_of (tree obj, tree type, edge entry,
       if (gsi == NULL)
        return NULL;
       addr = TREE_OPERAND (*var_p, 0);
-      name = make_temp_ssa_name (TREE_TYPE (addr), NULL,
-                                get_name (TREE_OPERAND
-                                          (TREE_OPERAND (*var_p, 0), 0)));
+      const char *obj_name
+       = get_name (TREE_OPERAND (TREE_OPERAND (*var_p, 0), 0));
+      if (obj_name)
+       name = make_temp_ssa_name (TREE_TYPE (addr), NULL, obj_name);
+      else
+       name = make_ssa_name (TREE_TYPE (addr), NULL);
       stmt = gimple_build_assign (name, addr);
       gsi_insert_on_edge_immediate (entry, stmt);
 
@@ -694,6 +697,12 @@ eliminate_local_variables_stmt (edge entry, gimple_stmt_iterator *gsi,
          dta.changed = true;
        }
     }
+  else if (gimple_clobber_p (stmt))
+    {
+      stmt = gimple_build_nop ();
+      gsi_replace (gsi, stmt, false);
+      dta.changed = true;
+    }
   else
     {
       dta.gsi = gsi;