[gcc(refs/vendors/ibm/heads/gcc-9-branch)] Revert patch for PR fortran/93956.

Peter Bergner bergner@gcc.gnu.org
Fri Sep 4 19:07:48 GMT 2020


https://gcc.gnu.org/g:cb2c76c8b156c6d8541ddb3aa894568a2de3b02b

commit cb2c76c8b156c6d8541ddb3aa894568a2de3b02b
Author: Thomas Koenig <tkoenig@gcc.gnu.org>
Date:   Fri May 1 14:45:56 2020 +0200

    Revert patch for PR fortran/93956.
    
    2020-04-27  Thomas Koenig  <tkoenig@gcc.gnu.org>
    
                PR fortran/93956
                PR fortran/94788
                * expr.c (gfc_check_pointer_assign): Revert patch for PR 93956.
                * interface.c: Likewise.

Diff:
---
 gcc/fortran/ChangeLog                           |  7 ++++
 gcc/fortran/expr.c                              |  7 ++--
 gcc/fortran/interface.c                         | 34 ------------------
 gcc/testsuite/ChangeLog                         |  6 ++++
 gcc/testsuite/gfortran.dg/pointer_assign_13.f90 | 47 -------------------------
 5 files changed, 15 insertions(+), 86 deletions(-)

diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 787a7d57f79..c2032eccac9 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,10 @@
+2020-04-27  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+	PR fortran/93956
+	PR fortran/94788
+	* expr.c (gfc_check_pointer_assign): Revert patch for PR 93956.
+	* interface.c: Likewise.
+
 2020-04-24  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
 	Backport from trunk
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index deba751fe22..94f9eb00f71 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -4196,11 +4196,8 @@ gfc_check_pointer_assign (gfc_expr *lvalue, gfc_expr *rvalue,
   if (rvalue->expr_type == EXPR_NULL)
     return true;
 
-  /* A function may also return subref arrray pointer.  */
-
-  if ((rvalue->expr_type == EXPR_VARIABLE && is_subref_array (rvalue))
-      || rvalue->expr_type == EXPR_FUNCTION)
-      lvalue->symtree->n.sym->attr.subref_array_pointer = 1;
+  if (rvalue->expr_type == EXPR_VARIABLE && is_subref_array (rvalue))
+    lvalue->symtree->n.sym->attr.subref_array_pointer = 1;
 
   attr = gfc_expr_attr (rvalue);
 
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c
index 76bd1afd9c4..b5701b1a59a 100644
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -3654,36 +3654,6 @@ check_intents (gfc_formal_arglist *f, gfc_actual_arglist *a)
   return true;
 }
 
-/* Go through the argument list of a procedure and look for
-   pointers which may be set, possibly introducing a span.  */
-
-static void
-gfc_set_subref_array_pointer_arg (gfc_formal_arglist *dummy_args,
-				  gfc_actual_arglist *actual_args)
-{
-  gfc_formal_arglist *f;
-  gfc_actual_arglist *a;
-  gfc_symbol *a_sym;
-  for (f = dummy_args, a = actual_args; f && a ; f = f->next, a = a->next)
-    {
-
-      if (f->sym == NULL)
-	continue;
-
-      if (!f->sym->attr.pointer || f->sym->attr.intent == INTENT_IN)
-	continue;
-
-      if (a->expr == NULL || a->expr->expr_type != EXPR_VARIABLE)
-	continue;
-      a_sym = a->expr->symtree->n.sym;
-
-      if (!a_sym->attr.pointer)
-	continue;
-
-      a_sym->attr.subref_array_pointer = 1;
-    }
-  return;
-}
 
 /* Check how a procedure is used against its interface.  If all goes
    well, the actual argument list will also end up being properly
@@ -3835,10 +3805,6 @@ gfc_procedure_use (gfc_symbol *sym, gfc_actual_arglist **ap, locus *where)
   if (warn_aliasing)
     check_some_aliasing (dummy_args, *ap);
 
-  /* Set the subref_array_pointer_arg if needed.  */
-  if (dummy_args)
-    gfc_set_subref_array_pointer_arg (dummy_args, *ap);
-
   return true;
 }
 
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 49e8d899e5e..52ca2715aff 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2020-05-01  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+	PR fortran/93956
+	PR fortran/94788
+	* gfortran.dg/pointer_assign_13.f90: Remove.
+
 2020-04-29  H.J. Lu  <hongjiu.lu@intel.com>
 
 	Backport from master
diff --git a/gcc/testsuite/gfortran.dg/pointer_assign_13.f90 b/gcc/testsuite/gfortran.dg/pointer_assign_13.f90
deleted file mode 100644
index b3f2cd9dab7..00000000000
--- a/gcc/testsuite/gfortran.dg/pointer_assign_13.f90
+++ /dev/null
@@ -1,47 +0,0 @@
-! { dg-do run }
-! PR 93956 - span was set incorrectly, leading to wrong code.
-! Original test case by "martin".
-program array_temps
-  implicit none
-  
-  type :: tt
-     integer :: u = 1
-     integer :: v = 2
-  end type tt
-
-  type(tt), dimension(:), pointer :: r
-  integer :: n
-  integer, dimension(:), pointer :: p, q, u
-
-  n = 10
-  allocate(r(1:n))
-  call foo(r%v,n)
-  p => get(r(:))
-  call foo(p, n)
-  call get2(r,u)
-  call foo(u,n)
-  q => r%v
-  call foo(q, n)
-
-deallocate(r)
-
-contains
-
-   subroutine foo(a, n)
-      integer, dimension(:), intent(in) :: a
-      integer, intent(in) :: n
-      if (sum(a(1:n)) /= 2*n) stop 1
-   end subroutine foo
-
-   function get(x) result(q)
-      type(tt), dimension(:), target, intent(in) :: x
-      integer, dimension(:), pointer :: q
-      q => x(:)%v
-   end function get
-
-   subroutine get2(x,q)
-      type(tt), dimension(:), target, intent(in) :: x
-      integer, dimension(:), pointer, intent(out) :: q
-      q => x(:)%v
-    end subroutine get2
-end program array_temps


More information about the Gcc-cvs mailing list