This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, Fortran] PR42517: Bogus runtime error with -fopenmp -fcheck=recursion


Janus Weil wrote:

> I recently noticed that -fcheck=recursion does not work together with
> OpenMP. This is not surprising, since all that the recursion check
> does is setting some internal logical variable to true when entering
> the procedure and setting it back to false when leaving. So that, if
> the procedure is already being executed, a second instance of that
> procedure can detect this situation and throw a runtime error.
> 
> Now, in an OpenMP program you typically have several parallel threads,
> and any procedure can simultaneously be executed in multiple threads
> without being called recursively. Therefore the recursion check simply
> does not work for this case and throws false errors galore.

> Surely there are ways to make the check work also for parallel
> programs. 

  Yes, that's what TLS was made for; I hesitate to use the word "trivial"
since it won't be, but conceptually it is: just create a __thread variable
instead of an ordinary static one for the recursion check guard var.

    cheers,
      DaveK


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]