diff options
author | Jakub Jelinek <jakub@redhat.com> | 2010-04-26 22:07:10 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2010-04-26 22:07:10 +0200 |
commit | b83a701b0f79c99a487202016d158c40eb0c4629 (patch) | |
tree | 20ef77abbc49b7740132e220cf8488695349b001 /gcc/c-omp.c | |
parent | 8415f31724e1cb601b97b3f82292a24257cb5ff9 (diff) | |
download | gcc-b83a701b0f79c99a487202016d158c40eb0c4629.zip gcc-b83a701b0f79c99a487202016d158c40eb0c4629.tar.gz gcc-b83a701b0f79c99a487202016d158c40eb0c4629.tar.bz2 |
re PR c/43893 (Error: Invalid controlling predicate with -fopenmp)
PR c/43893
* c-omp.c (c_finish_omp_for): Handle also EQ_EXPR.
* testsuite/libgomp.c/pr43893.c: New test.
* testsuite/libgomp.c++/pr43893.C: New test.
From-SVN: r158745
Diffstat (limited to 'gcc/c-omp.c')
-rw-r--r-- | gcc/c-omp.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/gcc/c-omp.c b/gcc/c-omp.c index eb6f3ef..012a632 100644 --- a/gcc/c-omp.c +++ b/gcc/c-omp.c @@ -1,7 +1,7 @@ /* This file contains routines to construct GNU OpenMP constructs, called from parsing in the C and C++ front ends. - Copyright (C) 2005, 2007, 2008, 2009 Free Software Foundation, Inc. + Copyright (C) 2005, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. Contributed by Richard Henderson <rth@redhat.com>, Diego Novillo <dnovillo@redhat.com>. @@ -301,7 +301,8 @@ c_finish_omp_for (location_t locus, tree declv, tree initv, tree condv, || TREE_CODE (cond) == LE_EXPR || TREE_CODE (cond) == GT_EXPR || TREE_CODE (cond) == GE_EXPR - || TREE_CODE (cond) == NE_EXPR) + || TREE_CODE (cond) == NE_EXPR + || TREE_CODE (cond) == EQ_EXPR) { tree op0 = TREE_OPERAND (cond, 0); tree op1 = TREE_OPERAND (cond, 1); @@ -346,18 +347,21 @@ c_finish_omp_for (location_t locus, tree declv, tree initv, tree condv, cond_ok = true; } - if (TREE_CODE (cond) == NE_EXPR) + if (TREE_CODE (cond) == NE_EXPR + || TREE_CODE (cond) == EQ_EXPR) { if (!INTEGRAL_TYPE_P (TREE_TYPE (decl))) cond_ok = false; else if (operand_equal_p (TREE_OPERAND (cond, 1), TYPE_MIN_VALUE (TREE_TYPE (decl)), 0)) - TREE_SET_CODE (cond, GT_EXPR); + TREE_SET_CODE (cond, TREE_CODE (cond) == NE_EXPR + ? GT_EXPR : LE_EXPR); else if (operand_equal_p (TREE_OPERAND (cond, 1), TYPE_MAX_VALUE (TREE_TYPE (decl)), 0)) - TREE_SET_CODE (cond, LT_EXPR); + TREE_SET_CODE (cond, TREE_CODE (cond) == NE_EXPR + ? LT_EXPR : GE_EXPR); else cond_ok = false; } |