This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[gomp] Allow unsigned iterator with just a warning (PR c/27499)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Richard Henderson <rth at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 12 May 2006 22:34:34 +0200
- Subject: [gomp] Allow unsigned iterator with just a warning (PR c/27499)
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
In c-omp.c, we just warn if #pragma omp {,parallel }for iterator is
unsigned, but later on in gimplify_omp_for we assert it is signed.
I believe the assert is not needed, the user has been warned that the code
might not do what he wants and usually it will work as expected.
Ok for trunk?
2006-05-12 Jakub Jelinek <jakub@redhat.com>
PR c/27499
* gimplify.c (gimplify_omp_for): Remove assertion that iteration var
is signed.
* gcc.dg/gomp/pr27499.c: New test.
* g++.dg/gomp/pr27499.C: New test.
--- gcc/gimplify.c.jj 2006-05-10 14:07:01.000000000 +0200
+++ gcc/gimplify.c 2006-05-12 22:13:05.000000000 +0200
@@ -4750,7 +4750,6 @@ gimplify_omp_for (tree *expr_p, tree *pr
decl = TREE_OPERAND (t, 0);
gcc_assert (DECL_P (decl));
gcc_assert (INTEGRAL_TYPE_P (TREE_TYPE (decl)));
- gcc_assert (!TYPE_UNSIGNED (TREE_TYPE (decl)));
/* Make sure the iteration variable is private. */
if (omp_is_private (gimplify_omp_ctxp, decl))
--- gcc/testsuite/gcc.dg/gomp/pr27499.c.jj 2006-05-12 22:22:37.000000000 +0200
+++ gcc/testsuite/gcc.dg/gomp/pr27499.c 2006-05-12 22:22:26.000000000 +0200
@@ -0,0 +1,13 @@
+/* PR c/27499 */
+/* { dg-do compile } */
+
+extern void bar (unsigned int);
+
+void
+foo (void)
+{
+ unsigned int i;
+#pragma omp parallel for
+ for (i = 0; i < 64; ++i) /* { dg-warning "is unsigned" } */
+ bar (i);
+}
--- gcc/testsuite/g++.dg/gomp/pr27499.C.jj 2006-05-12 22:23:14.000000000 +0200
+++ gcc/testsuite/g++.dg/gomp/pr27499.C 2006-05-12 22:24:06.000000000 +0200
@@ -0,0 +1,13 @@
+// PR c/27499
+// { dg-do compile }
+
+extern void bar (unsigned int);
+
+void
+foo (void)
+{
+ unsigned int i;
+#pragma omp for
+ for (i = 0; i < 64; ++i) // { dg-warning "is unsigned" }
+ bar (i);
+}
Jakub