[gcc r16-4111] Fortran: Revert r16-4069 causing memory leaks in f951 [PR87908]

Paul Thomas pault@gcc.gnu.org
Sat Sep 27 07:01:42 GMT 2025


https://gcc.gnu.org/g:25f7f04e447dc0d2ed4c392eb21765e9ae9067d1

commit r16-4111-g25f7f04e447dc0d2ed4c392eb21765e9ae9067d1
Author: Paul Thomas <pault@gcc.gnu.org>
Date:   Sat Sep 27 08:01:30 2025 +0100

    Fortran: Revert r16-4069 causing memory leaks in f951 [PR87908]
    
    2025-09-27  Paul Thomas  <pault@gcc.gnu.org>
    
    gcc/fortran
            PR fortran/87908
            * interface.cc (check_interface0): Revert changes.
    
    gcc/testsuite/
            PR fortran/87908
            * gfortran.dg/pr87908.f90: Delete.

Diff:
---
 gcc/fortran/interface.cc              | 19 --------------
 gcc/testsuite/gfortran.dg/pr87908.f90 | 49 -----------------------------------
 2 files changed, 68 deletions(-)

diff --git a/gcc/fortran/interface.cc b/gcc/fortran/interface.cc
index 41c941726e22..ef5a17d0af45 100644
--- a/gcc/fortran/interface.cc
+++ b/gcc/fortran/interface.cc
@@ -1968,25 +1968,6 @@ check_interface0 (gfc_interface *p, const char *interface_name)
   psave = p;
   for (; p; p = p->next)
     {
-      if (p->sym->attr.vtab)
-	{
-	  bool found = false;
-	  gfc_component *c = p->sym->ts.u.derived->components;
-	  for (; c; c = c->next)
-	    {
-	      if (c->name[0] == '_')
-		continue;
-	      /* This check seems to be as much as can sensibly be done here.
-		 If there is more than one proc_pointer components, resolution
-		 of the call will select the right one.  */
-	      if (c->attr.proc_pointer && c->ts.interface
-		  && (c->attr.subroutine || c->attr.function))
-		found = true;
-	    }
-	  if (found)
-	    continue;
-	}
-
       /* Make sure all symbols in the interface have been defined as
 	 functions or subroutines.  */
       if (((!p->sym->attr.function && !p->sym->attr.subroutine)
diff --git a/gcc/testsuite/gfortran.dg/pr87908.f90 b/gcc/testsuite/gfortran.dg/pr87908.f90
deleted file mode 100644
index 6fdc109a6522..000000000000
--- a/gcc/testsuite/gfortran.dg/pr87908.f90
+++ /dev/null
@@ -1,49 +0,0 @@
-! { dg-do run }
-!
-! Check the fix for pr87908, which used to fail with error:
-! Procedure ‘__vtab_m_T’ in generic interface '_dtio_formatted_read' at (1) is
-! neither function nor subroutine.
-!
-! Contributed by David Bolvansky  <david.bolvansky@gmail.com>
-!
-module m
-   type t
-      character(34) :: c
-   contains
-      procedure :: g
-      generic :: read(formatted) => g
-   end type
-   integer :: ctr = 0
-contains
-   subroutine s (unit, x)
-      integer, intent(in) :: unit
-      integer, intent(in) :: x(:)
-      interface read(formatted)
-         procedure g
-      end interface
-   end
-   subroutine g (dtv, unit, iotype, v_list, iostat, iomsg)
-      class(t), intent(inout) :: dtv
-      integer, intent(in) :: unit
-      character(*), intent(in) :: iotype
-      integer, intent(in) :: v_list(:)
-      integer, intent(out) :: iostat
-      character(*), intent(inout) :: iomsg
-      read (unit, '(a)', iostat=iostat, iomsg=iomsg) dtv%c
-      ctr = ctr + 1
-   end
-end
-
-  use m
-  type(t) :: x
-  open (10, status = 'scratch')
-  write(10, fmt=*) "Mary had a little lamb            "
-  write(10, fmt=*) "whose fleece was as white as gold "
-  rewind(10)
-  read(10, fmt=*) x
-  if (trim(x%c) /= "Mary had a little lamb") stop 1
-  read(10, fmt=*) x
-  if (trim(x%c) /= "whose fleece was as white as gold") stop 2
-  close(10)
-  if (ctr /= 2) stop 3
-end


More information about the Gcc-cvs mailing list