------- Comment #3 from fxcoudert at gcc dot gnu dot org  2008-02-10 15:37 
-------
I have managed to reduce it a bit more, and it does not involve passing the
loop variable as an argument:

program outer
  integer k, a(1)
  a = 0.0
!$OMP PARALLEL DO
  do k = 1, 1
    call inner
  end do
!$OMP END PARALLEL DO
 print *, a(1)

contains
  subroutine inner
    a(1) = 42
  end subroutine inner
end program outer

>From the tree dump, I've made the following C testcase which also exhibits the
same bug:

$ cat u.c 
int main (void)
{
  int a[1], k;
  void inner (void) { a[0] = 42; }

  a[0] = 0;

  #pragma omp parallel
  #pragma omp for private(k) nowait
  for (k = 1; k <= 1; k = k + 1)
    inner ();

  __builtin_printf ("%d\n", a[0]);
  return 0;
}

$ gcc -fopenmp u.c && ./a.out
0


There is no OpenMP component, and since I'm not sure the C code I have created
is valid, I leave this bug as "fortran" for now... but I think it's a generic
issue of contained functions.


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fxcoudert at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-02-10 15:37:46
               date|                            |


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

Reply via email to