[Bug fortran/87907] ICE in resolve_contained_fntype, at fortran/resolve.c:587

kargl at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Jun 18 18:20:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87907

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu.org

--- Comment #3 from kargl at gcc dot gnu.org ---
This patch 

Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c       (revision 272432)
+++ gcc/fortran/resolve.c       (working copy)
@@ -583,6 +583,9 @@ resolve_contained_fntype (gfc_symbol *sym, gfc_namespa
       || sym->attr.entry_master)
     return;

+  if (!sym->result)
+    return;
+
   /* Try to find out of what the return type is.  */
   if (sym->result->ts.type == BT_UNKNOWN && sym->result->ts.interface == NULL)
     {

produces

% gfcx -c a.f90
a.f90:12:20:

   12 |       subroutine g(x)
      |                    1
Error: Type mismatch in argument 'x' (REAL(4)/INTEGER(4)) at (1)
a.f90:17:7:

   17 |    use m
      |       1
   18 |    integer :: x = 3
   19 |    call g(x)
      |            2
Error: 'g' at (1) has a type, which is not consistent with the CALL at (2)

Not sure if this is good enough.


More information about the Gcc-bugs mailing list