diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-01-17 22:26:42 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-01-17 22:26:42 +0000 |
commit | b6740ddaa9a3dde38b7d176def6e821e657240e3 (patch) | |
tree | aa50e1a8b8b10ba96d0ffb0526298e3164516071 /gcc/fortran/openmp.c | |
parent | 8e8bbfb1c5c18f5f8003ef66f26b8cdce7d920e2 (diff) |
PR fortran/47331
* gfortran.h (struct gfc_omp_saved_state): New type.
(gfc_omp_save_and_clear_state, gfc_omp_restore_state): New prototypes.
* resolve.c (resolve_global_procedure): Call it around gfc_resolve
call.
* openmp.c (gfc_omp_save_and_clear_state, gfc_omp_restore_state): New
functions.
* gfortran.dg/gomp/pr47331.f90: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@168935 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/openmp.c')
-rw-r--r-- | gcc/fortran/openmp.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c index 6e8182118ce6..24e32eb5d044 100644 --- a/gcc/fortran/openmp.c +++ b/gcc/fortran/openmp.c @@ -1390,6 +1390,31 @@ gfc_resolve_omp_parallel_blocks (gfc_code *code, gfc_namespace *ns) } +/* Save and clear openmp.c private state. */ + +void +gfc_omp_save_and_clear_state (struct gfc_omp_saved_state *state) +{ + state->ptrs[0] = omp_current_ctx; + state->ptrs[1] = omp_current_do_code; + state->ints[0] = omp_current_do_collapse; + omp_current_ctx = NULL; + omp_current_do_code = NULL; + omp_current_do_collapse = 0; +} + + +/* Restore openmp.c private state from the saved state. */ + +void +gfc_omp_restore_state (struct gfc_omp_saved_state *state) +{ + omp_current_ctx = (struct omp_context *) state->ptrs[0]; + omp_current_do_code = (gfc_code *) state->ptrs[1]; + omp_current_do_collapse = state->ints[0]; +} + + /* Note a DO iterator variable. This is special in !$omp parallel construct, where they are predetermined private. */ |