Hi Harald,

the Fortran standard requires an explicit procedure interface in certain
situations, such as when they have a BIND(C) attribute (F2018:15.4.2.2).
The attached patch adds a check for this.

Regtested on x86_64-pc-linux-gnu.  OK for mainline?

While this fixes the ICE, it misses

function f() bind(c)
  f = 42.
end

subroutine p
  bind(c) f     ! { dg-error "must be explicit" }
  x = f()
end

subroutine s
  interface
     function g() bind(c)
     end function g
  end interface
  x = g()
end

where the interface is picked up via a global symbol.  This code
may not be valid; nagfor rejects it, but I cannot find a
constraint at least in the F2022 draft that prohibits it.

Hm... might it be better to check for attr->module_procedure ||
attr->if_source == IFSRC_IFBODY?

Best regards

        Thomas

Reply via email to