% cat test.c

#include <stdlib.h>
#include <omp.h>

void foo(unsigned ub, unsigned *array)
{
    unsigned i;

// test passes for N >= 1
#define N       0

#pragma omp for
    for (i = ub; i > N; i -=2) {
        array[i] = i;
    }
}

% gcc -fopenmp -c test.c
test.c: In function &#915;Çÿfoo&#915;ÇÖ:
test.c:13: error: invalid controlling predicate
% gcc -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: /net/gnu-13/export/gnu/src/gcc/gcc/configure --enableclocale=g
nu --with-system-zlib --enable-checking=assert --with-demangler-in-ld
--enable-shared --enable-threads=posix --enable-haifa --prefix=/usr/gcc-4.4
--with-local-prefix=/usr/local
Thread model: posix
gcc version 4.4.0 20090311 (experimental) [trunk revision 144788] (GCC)

Aparrently, the compiler is trying to prevent the user from accidentally
running into an infinite loop, if the value of lb is odd.  Nonetheless, the
program is legal if lb is even, but it won't compile.


-- 
           Summary: OMP parallel loop w/ unsigned index var rejected
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: trivial
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: brian dot e dot bliss at intel dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39495

Reply via email to