http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45784
Summary: gcc OpenMP - error: invalid controlling predicate Product: gcc Version: 4.5.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassig...@gcc.gnu.org ReportedBy: g...@cray.com The test is verifying that the parallel for loop construct may use a variable of a pointer type in C. The OpenMP API Version 3.0 (May 2008) describes this usage on page 39 of the document. Currently the GNU gcc compiler produces the following messages for this test case: ISU3417.c: In function 'vla_test': ISU3417.c:23:25: error: invalid controlling predicate The PGI, Intel, and Cray compilers compile this test case successfully. $ cat ISU3417.c // derived from OpenMP test omp3c/c03_2_5_1_2c.c #include <omp.h> #include <stdio.h> #include <stdlib.h> #define NT 4 #define INCREMENT 2 #define ARRAY_SIZE INCREMENT*NT // VLAs are standard only in C99; might as well use a C99-specific data type // (long long int) while we're testing C99-specific features void vla_test(int num_threads) { long long int *ptr, vla[INCREMENT*num_threads]; //long long int *ptr, vla[INCREMENT*40]; int i; // variable-length array initialized to -1 for (i = 0; i < sizeof(vla)/sizeof(vla[0]); i++) { vla[i] = -1; } #pragma omp parallel shared(vla) { #pragma omp for schedule(static, 1) for (ptr = vla; ptr < vla + sizeof(vla)/sizeof(vla[0]); ptr = ptr + INCREMENT) *ptr = omp_get_thread_num(); } for (i = 0; i < sizeof(vla)/sizeof(vla[0]); i++) { if (vla[i] != (i % INCREMENT == 0 ? (i/INCREMENT) % num_threads : -1)) { fprintf(stderr, "%s:%i: FAIL - vla[%i] == %lli != %i\n", __FILE__, __LINE__, i, vla[i], (i % INCREMENT == 0 ? (i/INCREMENT) % num_threads : -1)); exit(1); } } } int main(void) { omp_set_dynamic(0); omp_set_num_threads(NT); vla_test(NT); return 0; } $ gcc -c -fopenmp -std=c99 ISU3417.c ISU3417.c: In function 'vla_test': ISU3417.c:24:25: error: invalid controlling predicate $ Other compilers working: $ pgcc -mp -c ISU3417.c $ icc -c -openmp ISU3417.c $ cc -c -omp -V ISU3417.c /opt/cray/xt-asyncpe/4.4.9/bin/cc: INFO: Compiling for compute nodes running CLE. Cray C : Version 7.2.7 (u7267c72242i72182p72540a72002e60006z72540) Cray C : (x7205r72009w71001t7207) Cray C : Fri Sep 24, 2010 14:34:26 $ -- Configure bugmail: http://gcc.gnu.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.