Problem with threadprivate procedure pointers with gfortran 4.6

Andrew Benson abenson@its.caltech.edu
Fri Aug 26 16:16:00 GMT 2011


Hi Janus,

> > (weird formatting due to the two threads writing simultaneously).
> 
> For me the typical output (with two threads) looks like this, also
> with 4.7 trunk:
> 
> jweil@manzanita:~> ./a.out
>            1              4196740
>  do task 1
>            0              4196740
>  do task 1
>            1              4196740
> STOP wrong thread in Proc_To_Call1 do task 1
> 
>            1              4196740
>  do task 1
>            1              4196740
> 
> > When I encountered the similar problem with 4.4 I wasn't entirely sure
> > that a threadprivate procedure pointer was valid (or if it's just an
> > undefined situation).
> 
> Well, as noted by Jakub (and previously by Nick McLaren): OpenMP does
> not include any F03 features so far. This means it is not even aware
> of the concept of procedure pointers, so that it does not explicitly
> forbid their usage, but it also does not say anything on how they
> should be handled. So what you're doing is certainly undefined.
> 
> Actually I'm not sure how the situation would be with an analogous C
> program. (Probably the same?)
> 
> > Assuming that it is valid, this seems to be a bug.
> 
> No, it's just undefined, so the compiler can do whatever it pleases.
> 
> > I haven't
> > tested this in trunk yet, but I can try that tomorrow.
> 
> Trunk gives the same results as 4.5 and 4.6 for me (see above).

Thanks for the clarifications. I'll look forward to using Jakub's patch in 
4.7.

-Andrew.

-- 

* Andrew Benson: http://www.tapir.caltech.edu/~abenson/contact.html

* Galacticus: http://sites.google.com/site/galacticusmodel



More information about the Fortran mailing list