This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix OpenMP combined parallel non-static for (PR middle-end/25989)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Richard Henderson <rth at redhat dot com>, Diego Novillo <dnovillo at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 13 Mar 2006 13:52:28 -0500
- Subject: [PATCH] Fix OpenMP combined parallel non-static for (PR middle-end/25989)
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
The testcase below ICEs on the trunk. The problem is that only for
!in_combined_parallel loops we call build_fold_addr_expr (iend0);
and build_fold_addr_expr (istart0); before gimplifying:
t = fold_convert (type, istart0);
t = build2 (MODIFY_EXPR, void_type_node, fd->v, t);
gimplify_and_add (t, &list);
t = fold_convert (type, iend0);
t = build2 (MODIFY_EXPR, void_type_node, iend, t);
gimplify_and_add (t, &list);
For in_combined_parallel, the first build_fold_addr_expr on these
variables (.istart0* and .iend0*) is called after the above
gimplification, which means the variables don't have TREE_ADDRESSABLE
bit set yet. Setting it later on results in invalid GIMPLE.
The following patch fixes that (alternatively, we could call
e.g. build_fold_addr_expr on the vars and only use what it
returns in !in_combined_parallel case, but that would
create more garbage that needed.
Ok for trunk?
2006-03-13 Jakub Jelinek <jakub@redhat.com>
PR middle-end/25989
* omp-low.c (expand_omp_for_generic): Mark istart0
and iend0 as addressable.
* gcc.dg/gomp/pr25989.c: New test.
--- gcc/omp-low.c.jj 2006-03-12 09:51:32.000000000 +0100
+++ gcc/omp-low.c 2006-03-13 18:14:27.000000000 +0100
@@ -3,7 +3,7 @@
marshalling to implement data sharing and copying clauses.
Contributed by Diego Novillo <dnovillo@redhat.com>
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2006 Free Software Foundation, Inc.
This file is part of GCC.
@@ -2430,6 +2430,8 @@ expand_omp_for_generic (struct omp_regio
istart0 = create_tmp_var (long_integer_type_node, ".istart0");
iend0 = create_tmp_var (long_integer_type_node, ".iend0");
+ TREE_ADDRESSABLE (istart0) = 1;
+ TREE_ADDRESSABLE (iend0) = 1;
l0 = create_artificial_label ();
l1 = create_artificial_label ();
--- gcc/testsuite/gcc.dg/gomp/pr25989.c.jj 2006-03-13 18:16:57.000000000 +0100
+++ gcc/testsuite/gcc.dg/gomp/pr25989.c 2006-03-13 18:18:14.000000000 +0100
@@ -0,0 +1,16 @@
+/* PR middle-end/25989 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp" } */
+
+int
+main (void)
+{
+ int i, j;
+ float a, b = 1.0;
+
+#pragma omp parallel for schedule(guided,1) private(j)
+ for (i = 1; i <= 9; i++)
+ for (j = 1; j <= 9; j++)
+ a = b;
+ return 0;
+}
Jakub