From: Janus Weil Date: Tue, 29 Dec 2009 19:29:54 +0000 (+0100) Subject: re PR fortran/42517 (-fcheck=recursion does not work with -fopenmp) X-Git-Tag: releases/gcc-4.5.0~1489 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8b5f6dd83d7887c725337c83f302279946767212;p=thirdparty%2Fgcc.git re PR fortran/42517 (-fcheck=recursion does not work with -fopenmp) gcc/fortran/ 2009-12-29 Janus Weil PR fortran/42517 * invoke.texi: Document the interference of -fcheck=recursion and -fopenmp. * trans-decl.c (gfc_generate_function_code): Disable -fcheck=recursion when used with -fopenmp. gcc/testsuite/ 2009-12-29 Janus Weil PR fortran/42517 * gfortran.dg/gomp/recursion1.f90: New test. From-SVN: r155506 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 55fc75340992..43d206a14b7b 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,4 +1,12 @@ -2009-12-28 Janus Weil +2009-12-29 Janus Weil + + PR fortran/42517 + * invoke.texi: Document the interference of + -fcheck=recursion and -fopenmp. + * trans-decl.c (gfc_generate_function_code): Disable -fcheck=recursion + when used with -fopenmp. + +2009-12-28 Janus Weil PR fortran/42353 * symbol.c (gfc_find_derived_vtab): Make vtabs and vtypes private. @@ -14,7 +22,7 @@ explicitly declared if requested by the new flag. * invoke.texi: Document new flag -Wimplicit-procedure. -2009-12-17 Janus Weil +2009-12-17 Janus Weil PR fortran/42144 * trans-expr.c (select_class_proc): Skip abstract base types. @@ -39,7 +47,7 @@ PR fortran/42354 * expr.c (check_init_expr): Do not check for specification functions. -2009-12-11 Janus Weil +2009-12-11 Janus Weil PR fortran/42257 * module.c (write_dt_extensions): Check for accessibility. @@ -54,7 +62,7 @@ conversion. * gfortran.h gfc_type_convert_binary): Adjusted prototype. -2009-12-11 Janus Weil +2009-12-11 Janus Weil PR fortran/42335 * symbol.c (select_type_insert_tmp): Add an extra check for diff --git a/gcc/fortran/invoke.texi b/gcc/fortran/invoke.texi index 2485e37b9868..b9ad170e0cf5 100644 --- a/gcc/fortran/invoke.texi +++ b/gcc/fortran/invoke.texi @@ -1257,6 +1257,8 @@ Enable generation of run-time checks for pointers and allocatables. @item @samp{recursion} Enable generation of run-time checks for recursively called subroutines and functions which are not marked as recursive. See also @option{-frecursive}. +Note: This check does not work for OpenMP programs and is disabled if used +together with @option{-fopenmp}. @end table diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 2e3fedd0ed3f..9a01dbab32cf 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -4318,7 +4318,8 @@ gfc_generate_function_code (gfc_namespace * ns) is_recursive = sym->attr.recursive || (sym->attr.entry_master && sym->ns->entries->sym->attr.recursive); - if ((gfc_option.rtcheck & GFC_RTCHECK_RECURSION) && !is_recursive) + if ((gfc_option.rtcheck & GFC_RTCHECK_RECURSION) && !is_recursive + && !gfc_option.flag_openmp) { char * msg; @@ -4395,7 +4396,8 @@ gfc_generate_function_code (gfc_namespace * ns) gfc_add_expr_to_block (&block, tmp); /* Reset recursion-check variable. */ - if ((gfc_option.rtcheck & GFC_RTCHECK_RECURSION) && !is_recursive) + if ((gfc_option.rtcheck & GFC_RTCHECK_RECURSION) && !is_recursive + && !gfc_option.flag_openmp) { gfc_add_modify (&block, recurcheckvar, boolean_false_node); recurcheckvar = NULL; @@ -4426,7 +4428,8 @@ gfc_generate_function_code (gfc_namespace * ns) { gfc_add_expr_to_block (&block, tmp); /* Reset recursion-check variable. */ - if ((gfc_option.rtcheck & GFC_RTCHECK_RECURSION) && !is_recursive) + if ((gfc_option.rtcheck & GFC_RTCHECK_RECURSION) && !is_recursive + && !gfc_option.flag_openmp) { gfc_add_modify (&block, recurcheckvar, boolean_false_node); recurcheckvar = NULL; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7705d827513b..8be8a062c451 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-12-29 Janus Weil + + PR fortran/42517 + * gfortran.dg/gomp/recursion1.f90: New test. + 2009-12-29 Eric Botcazou * gnat.dg/test_raise_from_pure.adb: XFAIL for the ARM. diff --git a/gcc/testsuite/gfortran.dg/gomp/recursion1.f90 b/gcc/testsuite/gfortran.dg/gomp/recursion1.f90 new file mode 100644 index 000000000000..0b7b2715fdd1 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/recursion1.f90 @@ -0,0 +1,27 @@ +! { dg-do run } +! { dg-options "-fopenmp -fcheck=recursion" } +! +! PR 42517: Bogus runtime error with -fopenmp -fcheck=recursion +! +! Contributed by Janus Weil + +implicit none +integer :: i,s + +s=0 +!$omp parallel do private(i) shared(s) +do i=1,10 + call sub(i) +end do +!$omp end parallel do +if (s/=55) call abort() + +contains + + subroutine sub (n) + integer :: n + s = s + n + print '(A,i3)',"loop =",n + end subroutine + +end