The following test program works as expected when compiled without -fopenmp. In some cases, such as shown below, it fails when the loop termination condition is already satisfied on entry:
[EMAIL PROTECTED] tmp]$ uname -a Linux carmenere.cfa.harvard.edu 2.6.18-1.2200.fc5 #1 SMP Sat Oct 14 16:59:56 EDT 2006 x86_64 x86_64 x86_64 GNU/Linux [EMAIL PROTECTED] tmp]$ gcc --version gcc (GCC) 4.1.1 20060525 (Red Hat 4.1.1-1) Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. [EMAIL PROTECTED] tmp]$ cat example.c #include <stdio.h> int main(int argc, char *argv[]) { int i, j, k; j = atoi(argv[1]); k = atoi(argv[2]); #pragma omp parallel for for (i = j; i <= k; ++i) printf("%d ", i); printf("done\n"); return 0; } [EMAIL PROTECTED] tmp]$ gcc -o example example.c [EMAIL PROTECTED] tmp]$ ./example 1 5 1 2 3 4 5 done [EMAIL PROTECTED] tmp]$ ./example 5 1 done [EMAIL PROTECTED] tmp]$ gcc -o example -fopenmp -lgomp example.c [EMAIL PROTECTED] tmp]$ ./example 1 5 4 5 1 2 3 done [EMAIL PROTECTED] tmp]$ ./example 5 1 -2147483644 -2147483643 -2147483642 -2147483641 -2147483640 -2147483639 -2147483638 -2147483637 -2147483636 -2147483635 -2147483634 -2147483633 -2147483632 -2147483631 -2147483630 -2147483629 -2147483628 -2147483627 -2147483626 -2147483625 -2147483624 -2147483623 -2147483622 -2147483621 -2147483620 -2147483619 -2147483618 -2147483617 -2147483616 -2147483615 -2147483614 -2147483613 -2147483612 -2147483611 -2147483610 -2147483609 -2147483608 -2147483607 -2147483606 -2147483605 -2147483604 -2147483603 ..... etc. -- Summary: OpenMP parallel for fails for reversed loop range Product: gcc Version: 4.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: spaine at cfa dot harvard dot edu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29947