[gcc/devel/autopar_devel] Fortran : ICE in generic_correspondence PR95584

Giuliano Belinassi giulianob@gcc.gnu.org
Sat Aug 22 23:12:43 GMT 2020


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

commit fb4a20d95983d4c6548cf559ab3021f67671b5e4
Author: Mark Eggleston <markeggleston@gcc.gnu.org>
Date:   Thu Jun 25 05:16:50 2020 +0100

    Fortran  : ICE in generic_correspondence PR95584
    
    Output an error for ambiguous interfaces in generic interface
    instead of ICE.
    
    2020-07-02  Steven G. Kargl  <kargl@gcc.gnu.org>
    
    gcc/fortran/
    
            PR fortran/95584
            * interface.c (generic_correspondence): Only use the pointer
            to a symbol if exists.
    
    2020-07-02  Mark Eggleston  <markeggleston@gcc.gnu.org>
    
    gcc/testsuite/
    
            PR fortran/95584
            * gfortran.dg/pr95584.f90: New test.

Diff:
---
 gcc/fortran/interface.c               |  2 +-
 gcc/testsuite/gfortran.dg/pr95584.f90 | 16 ++++++++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c
index b1a75a37b0e..0cc504f4e04 100644
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -1257,7 +1257,7 @@ generic_correspondence (gfc_formal_arglist *f1, gfc_formal_arglist *f2,
 
   while (f1)
     {
-      if (f1->sym->attr.optional)
+      if (!f1->sym || f1->sym->attr.optional)
 	goto next;
 
       if (p1 && strcmp (f1->sym->name, p1) == 0)
diff --git a/gcc/testsuite/gfortran.dg/pr95584.f90 b/gcc/testsuite/gfortran.dg/pr95584.f90
new file mode 100644
index 00000000000..4504f7b500c
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr95584.f90
@@ -0,0 +1,16 @@
+! { dg-do compile }
+
+program p
+   interface s
+      subroutine g(x, *)
+      end
+      subroutine h(y, *)
+      end
+   end interface
+end
+
+! { dg-warning "Obsolescent feature: Alternate-return argument" " " { target *-*-* } 5 }
+! { dg-warning "Obsolescent feature: Alternate-return argument" " " { target *-*-* } 7 }
+! { dg-error ".1." " " { target *-*-* } 5 }
+! { dg-error "Ambiguous interfaces in generic interface" " " { target *-*-* } 7 }
+


More information about the Gcc-cvs mailing list