+2009-05-08 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/39876
+ * intrinsic.c (gfc_is_intrinsic): Do not add the EXTERNAL attribute if
+ the symbol is a module procedure.
+
2009-05-08 Tobias Burnus <burnus@net-b.de>
* invoke.texi: Add do/recursion to the -fcheck= summary.
/* See if this intrinsic is allowed in the current standard. */
if (gfc_check_intrinsic_standard (isym, &symstd, false, loc) == FAILURE)
{
- if (gfc_option.warn_intrinsics_std)
- gfc_warning_now ("The intrinsic '%s' at %L is not included in the"
- " selected standard but %s and '%s' will be treated as"
- " if declared EXTERNAL. Use an appropriate -std=*"
- " option or define -fall-intrinsics to allow this"
- " intrinsic.", sym->name, &loc, symstd, sym->name);
- sym->attr.external = 1;
+ if (sym->attr.proc == PROC_UNKNOWN)
+ {
+ if (gfc_option.warn_intrinsics_std)
+ gfc_warning_now ("The intrinsic '%s' at %L is not included in the"
+ " selected standard but %s and '%s' will be"
+ " treated as if declared EXTERNAL. Use an"
+ " appropriate -std=* option or define"
+ " -fall-intrinsics to allow this intrinsic.",
+ sym->name, &loc, symstd, sym->name);
+ gfc_add_external (&sym->attr, &loc);
+ }
return false;
}
--- /dev/null
+! { dg-do compile }
+! { dg-options "-std=f95" }
+!
+! PR 39876: module procedure name that collides with the GNU intrinsic
+!
+! Contributed by Alexei Matveev <alexei.matveev+gcc@gmail.com>
+
+module p
+ implicit none
+
+ contains
+
+ subroutine test()
+ implicit none
+ print *, avg(erfc)
+ end subroutine test
+
+ function avg(f)
+ implicit none
+ double precision :: avg
+ interface
+ double precision function f(x)
+ implicit none
+ double precision, intent(in) :: x
+ end function f
+ end interface
+ avg = ( f(1.0D0) + f(2.0D0) ) / 2
+ end function avg
+
+ function erfc(x)
+ implicit none
+ double precision, intent(in) :: x
+ double precision :: erfc
+ erfc = x
+ end function erfc
+
+end module p
+
+! { dg-final { cleanup-modules "p" } }
+