backport: re PR fortran/39876 (module procedure name that collides with the GNU intrinsic)

2009-09-11 Steven G. Kargl  <kargl@gcc.gnu.org>

	Backport from mainline, r147279:

    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  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/39876
	* gfortran.dg/intrinsic_3.f90: New.

From-SVN: r151645
This commit is contained in:
Steven G. Kargl 2009-09-11 22:11:06 +00:00
parent a34c530475
commit 12a5a989ea
4 changed files with 70 additions and 7 deletions

View File

@ -1,3 +1,13 @@
2009-09-11 Steven G. Kargl <kargl@gcc.gnu.org>
Backported from mainline:
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-09-05 Paul Thomas <pault@gcc.gnu.org>
PR fortran/41258

View File

@ -836,13 +836,17 @@ gfc_is_intrinsic (gfc_symbol* sym, int subroutine_flag, locus loc)
/* 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;
}

View File

@ -1,3 +1,12 @@
2009-09-11 Steven G. Kargl <kargl@gcc.gnu.org>
Backported from mainline:
2009-05-08 Janus Weil <janus@gcc.gnu.org>
PR fortran/39876
* gfortran.dg/intrinsic_3.f90: New.
2009-09-10 H.J. Lu <hongjiu.lu@intel.com>
* gcc.dg/pr41241.c: Removed.

View File

@ -0,0 +1,40 @@
! { 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" } }