From c7d3bb7623a428af85bd04c7f225ed54241c29bd Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Mon, 17 Jan 2011 23:26:42 +0100 Subject: re PR fortran/47331 (ICE in make_decl_rtl, at varasm.c:1133 (with -fopenmp)) 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. From-SVN: r168935 --- gcc/fortran/openmp.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'gcc/fortran/openmp.c') diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c index 6e81821..24e32eb 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. */ -- cgit v1.1