Make recursion_check work for multiple threads
authorJanne Blomqvist <jb@gcc.gnu.org>
Fri, 23 Nov 2018 20:42:03 +0000 (22:42 +0200)
committerJanne Blomqvist <jb@gcc.gnu.org>
Fri, 23 Nov 2018 20:42:03 +0000 (22:42 +0200)
commitf4c0f888817ee7c593b56a5fe47b4acfbc83c7d3
tree4ab252c7af94ffd81381887e7c0c7777d36818c4
parent70c70369ce868fd8b049f710c01a899e502f6f68
Make recursion_check work for multiple threads

With multiple threads, using an unprotected static variable to check
whether recursion has occured isn't valid, as one thread might have
modified the variable, thus causing another thread to incorrectly
conclude that recursion has occured.  This patch avoids this problem
by using a thread-specific variable for the recursion check.

Regtested on x86_64-pc-linux-gnu.

libgfortran/ChangeLog:

2018-11-23  Janne Blomqvist  <jb@gcc.gnu.org>

* runtime/error.c (MAGIC): Remove.
(recursion_key): New variable.
(recursion_check): Use thread-specific variable for recursion
check if threads are active.
(constructor_recursion_check): New function.
(destructor_recursion_check): New funcion.

From-SVN: r266419
libgfortran/ChangeLog
libgfortran/runtime/error.c