]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/42517 (-fcheck=recursion does not work with -fopenmp)
authorJanus Weil <janus@gcc.gnu.org>
Tue, 29 Dec 2009 19:29:54 +0000 (20:29 +0100)
committerJanus Weil <janus@gcc.gnu.org>
Tue, 29 Dec 2009 19:29:54 +0000 (20:29 +0100)
gcc/fortran/
2009-12-29  Janus Weil  <janus@gcc.gnu.org>

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  <janus@gcc.gnu.org>

PR fortran/42517
* gfortran.dg/gomp/recursion1.f90: New test.

From-SVN: r155506

gcc/fortran/ChangeLog
gcc/fortran/invoke.texi
gcc/fortran/trans-decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/gomp/recursion1.f90 [new file with mode: 0644]

index 55fc753409924fd4afca2a526647a4cae1ac2f9f..43d206a14b7b5d0363f04904e1243c090d8e6ecd 100644 (file)
@@ -1,4 +1,12 @@
-2009-12-28 Janus Weil  <janus@gcc.gnu.org>
+2009-12-29  Janus Weil  <janus@gcc.gnu.org>
+
+       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  <janus@gcc.gnu.org>
 
        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  <janus@gcc.gnu.org>
+2009-12-17  Janus Weil  <janus@gcc.gnu.org>
 
        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  <janus@gcc.gnu.org>
+2009-12-11  Janus Weil  <janus@gcc.gnu.org>
 
        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  <janus@gcc.gnu.org>
+2009-12-11  Janus Weil  <janus@gcc.gnu.org>
 
        PR fortran/42335
        * symbol.c (select_type_insert_tmp): Add an extra check for
index 2485e37b986895edb3973ccf731638c78aa910d8..b9ad170e0cf563392a3a274ad83f0a468935f461 100644 (file)
@@ -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
 
 
index 2e3fedd0ed3f09408b32f8ff73e36da966938181..9a01dbab32cf50c2ae3cfffe1dd4e8d8b8a73809 100644 (file)
@@ -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;
index 7705d827513b7a7725cafc50123edd8871e5b8dd..8be8a062c451ad2c56bf47d9c3fa43211e1200c9 100644 (file)
@@ -1,3 +1,8 @@
+2009-12-29  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/42517
+       * gfortran.dg/gomp/recursion1.f90: New test.
+
 2009-12-29  Eric Botcazou  <ebotcazou@adacore.com>
 
        * 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 (file)
index 0000000..0b7b271
--- /dev/null
@@ -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 <janus@gcc.gnu.org>
+
+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