gfortran openmp: lastprivate variable is private in outer context

Tobias Burnus burnus@net-b.de
Fri Oct 26 07:48:00 GMT 2007


Hi Vasilis,

Liaskovitis, Vasileios wrote:
> I have an issue compiling the following fortran openmp code using gcc4.3 [...]
> fortran2.f:11: error: lastprivate variable "i2" is private in outer
>   
I forwarded the email to Jakub Jelinek, who implemented OpenMP in GCC,
and he agrees that this is seemingly a GCC bug and stated: "I'll handle
it once I get to it."

To track it, I filled the bug at
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33904

> Replacing:
> !$OMP+DEFAULT(SHARED)
> with:
> !$OMP+SHARED(I1,I2)
> makes the code compile successfully with gfortran.
>   
This is also the suggested work around.

> (this testcase is derived from a benchmark suite that doesn't allow
> source code modifications. gfortran should be able to compile this with
> no code changes - if this is indeed openmp-compliant code)
>   
Well, independent whether the code is modifiable or not, gfortran should
compile any standard-compliant code.

Thanks for reporting the bug.

Tobias



More information about the Fortran mailing list