This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix up parloops with debug labels (PR tree-optimization/52429)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 29 Feb 2012 16:31:22 +0100
- Subject: [PATCH] Fix up parloops with debug labels (PR tree-optimization/52429)
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
Since debug stmts can contain LABEL_DECLs we can ICE in parloops on them,
fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux. Ok
for trunk?
2012-02-29 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/52429
* tree-parloops.c (separate_decls_in_region_debug): Return early
if var is LABEL_DECL.
* gcc.dg/torture/pr52429.c: New test.
* g++.dg/opt/pr52429.C: New test.
--- gcc/tree-parloops.c.jj 2012-02-12 15:46:32.000000000 +0100
+++ gcc/tree-parloops.c 2012-02-29 13:06:18.857910264 +0100
@@ -909,7 +909,7 @@ separate_decls_in_region_debug (gimple s
var = gimple_debug_source_bind_get_var (stmt);
else
return true;
- if (TREE_CODE (var) == DEBUG_EXPR_DECL)
+ if (TREE_CODE (var) == DEBUG_EXPR_DECL || TREE_CODE (var) == LABEL_DECL)
return true;
gcc_assert (DECL_P (var) && SSA_VAR_P (var));
ielt.uid = DECL_UID (var);
--- gcc/testsuite/gcc.dg/torture/pr52429.c.jj 2012-02-29 13:39:25.133074390 +0100
+++ gcc/testsuite/gcc.dg/torture/pr52429.c 2012-02-29 13:39:04.000000000 +0100
@@ -0,0 +1,24 @@
+/* PR tree-optimization/52429 */
+/* { dg-do compile } */
+/* { dg-require-effective-target pthread } */
+/* { dg-options "-g -ftree-parallelize-loops=4" } */
+
+double d[65536], e[65536];
+
+void
+foo (void)
+{
+ int i;
+ double f, g;
+ for (i = 0; i < 65536; i++)
+ {
+ f = e[i];
+ goto lab1;
+ lab2:
+ d[i] = f * g;
+ continue;
+ lab1:
+ g = d[i];
+ goto lab2;
+ }
+}
--- gcc/testsuite/g++.dg/opt/pr52429.C.jj 2012-02-29 13:37:15.918778821 +0100
+++ gcc/testsuite/g++.dg/opt/pr52429.C 2012-02-29 13:36:42.000000000 +0100
@@ -0,0 +1,23 @@
+// PR tree-optimization/52429
+// { dg-do compile }
+// { dg-require-effective-target pthread }
+// { dg-options "-O -g -ftree-parallelize-loops=4" }
+
+struct B
+{
+ B () : b (__null) {}
+ int *b;
+};
+
+void *
+operator new (__SIZE_TYPE__, void *p)
+{
+ return p;
+}
+
+void
+foo (B *x, unsigned y)
+{
+ while (y--)
+ new (x) B;
+}
Jakub