if (gsym->ns)
gfc_find_symbol (sym->name, gsym->ns, 0, &def_sym);
+ if (gsym->bind_c && def_sym && def_sym->binding_label == NULL)
+ return 0;
+
if (def_sym)
{
gfc_compare_actual_formal (&actual, def_sym->formal, 0, 0, 0, loc);
if (sym->binding_label)
sym_name = sym->binding_label;
+ else if (sym->attr.use_rename
+ && sym->ns->use_stmts->rename
+ && sym->ns->use_stmts->rename->local_name[0] != '\0')
+ sym_name = sym->ns->use_stmts->rename->local_name;
else
sym_name = sym->name;
--- /dev/null
+! { dg-do compile }
+!
+! PR fortran/110993 - bogus diagnostics on renamed interface import
+!
+! Contributed by Rimvydas Jasinskas <rimvydas.jas at gmail.com>
+
+module m
+ interface
+ subroutine bar(x)
+ use iso_c_binding, only : c_float
+ implicit none
+ real(c_float) :: x(45)
+ end subroutine
+ end interface
+end
+
+module m1
+ interface
+ subroutine bar1(x) bind(c)
+ use iso_c_binding, only : c_float
+ implicit none
+ real(c_float) :: x(45)
+ end subroutine
+ end interface
+end
+
+module m2
+ interface
+ subroutine bar2(x) bind(c, name="bar2_")
+ use iso_c_binding, only : c_float
+ implicit none
+ real(c_float) :: x(45)
+ end subroutine
+ end interface
+end
+
+subroutine foo(y)
+ use m, notthisone => bar
+ use m1, northisone => bar1
+ use m2, orthisone => bar2
+ implicit none
+ real :: y(3)
+ call bar (y)
+ call bar1(y)
+ call bar2(y)
+end subroutine