if (c == '(')
{
(void) gfc_next_ascii_char ();
- if (!gfc_notify_std (GFC_STD_F2018, "IMPORT NONE with spec list at %C"))
+ if (!gfc_notify_std (GFC_STD_F2018, "IMPLICIT NONE with spec list at %C"))
return MATCH_ERROR;
gfc_gobble_whitespace ();
return false;
}
+ /* IMPLICIT NONE (external) procedures require an explicit EXTERNAL attr. */
+ /* Intrinsics were handled above, only non-intrinsics left here. */
+ if (sym->attr.flavor == FL_PROCEDURE
+ && sym->attr.implicit_type
+ && sym->ns
+ && sym->ns->has_implicit_none_export)
+ {
+ gfc_error ("Missing explicit declaration with EXTERNAL attribute "
+ "for symbol %qs at %L", sym->name, &sym->declared_at);
+ sym->error = 1;
+ return false;
+ }
+
/* The reference is to an external name. */
sym->attr.proc = PROC_EXTERNAL;
--- /dev/null
+! { dg-do compile }
+! { dg-options "-std=f2018" }
+! Tests fix for PR100972 - Fails to warn about missing EXTERNAL attribute
+! Contributed by Gerhard Steinmetz
+
+program p
+ implicit none (external)
+ real, external :: f
+ real :: a
+ real :: b
+ integer :: i
+ character :: c
+ a = f() ! OK
+ b = g() ! { dg-error "Missing explicit declaration with EXTERNAL attribute" }
+ i = h() ! { dg-error "Missing explicit declaration with EXTERNAL attribute" }
+ c = j() ! { dg-error "Missing explicit declaration with EXTERNAL attribute" }
+end
! Support Fortran 2018's IMPLICIT NONE with spec list
! (currently implemented as vendor extension)
-implicit none (type) ! { dg-error "Fortran 2018: IMPORT NONE with spec list at \\(1\\)" }
+implicit none (type) ! { dg-error "Fortran 2018: IMPLICIT NONE with spec list at \\(1\\)" }
end