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

kargl at gcc dot gnu.org changed:

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

--- Comment #2 from kargl at gcc dot gnu.org ---
(In reply to G. Steinmetz from comment #1)
> Related :
> 
> 
> $ cat z2.f90
> module m
>    interface
>       module function f()
>       end
>    end interface
>    interface
>       function f() bind(c)
>       end
>    end interface
> end
> 
> 
> $ gfortran-11-20200524 -c z2.f90
> f951: internal compiler error: Segmentation fault
> 0xbc0f6f crash_signal
>         ../../gcc/toplev.c:328
> 0x643eeb gfc_match_function_decl()
>         ../../gcc/fortran/decl.c:7398
> 0x6a82ca decode_statement
>         ../../gcc/fortran/parse.c:343
> 0x6a9e1a next_free
>         ../../gcc/fortran/parse.c:1279
> 0x6a9e1a next_statement
>         ../../gcc/fortran/parse.c:1511
> 0x6aba5c parse_interface
>         ../../gcc/fortran/parse.c:3519
> 0x6aba5c parse_spec
>         ../../gcc/fortran/parse.c:3875
> 0x6af43e parse_module
>         ../../gcc/fortran/parse.c:6115
> 0x6af787 gfc_parse_file()
>         ../../gcc/fortran/parse.c:6428
> 0x6fb9af gfc_be_parse_file
>         ../../gcc/fortran/f95-lang.c:210

Index: gcc/fortran/decl.c
===================================================================
--- gcc/fortran/decl.c  (revision 280157)
+++ gcc/fortran/decl.c  (working copy)
@@ -7325,7 +7325,8 @@ gfc_match_function_decl (void)
      procedure interface body.  */
     if (sym->attr.is_bind_c && sym->attr.module_procedure && sym->old_symbol
        && strcmp (sym->name, sym->old_symbol->name) == 0
-       && strcmp (sym->binding_label, sym->old_symbol->binding_label) != 0)
+       && (!sym->old_symbol->binding_label
+           || strcmp (sym->binding_label, sym->old_symbol->binding_label) !=
0))
       {
          const char *null = "NULL", *s1, *s2;
          s1 = sym->binding_label;

Reply via email to