aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJanus Weil <janus@gcc.gnu.org>2009-05-08 11:08:13 +0200
committerJanus Weil <janus@gcc.gnu.org>2009-05-08 11:08:13 +0200
commitcb8e4445ef25e1da025712d0595274b297b78ec1 (patch)
tree847c8a0d4b0bc94aa283129ae3a9a5e53fa4f2fc
parent3e807ffc9de5b1e8ec5641446619b9d9fab29d34 (diff)
downloadgcc-cb8e4445ef25e1da025712d0595274b297b78ec1.zip
gcc-cb8e4445ef25e1da025712d0595274b297b78ec1.tar.gz
gcc-cb8e4445ef25e1da025712d0595274b297b78ec1.tar.bz2
re PR fortran/39876 (module procedure name that collides with the GNU intrinsic)
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: r147279
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/intrinsic.c18
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/intrinsic_3.f9040
4 files changed, 62 insertions, 7 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index fc0a049..83ad8cd 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+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.
diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c
index 7676fa2..ca125a3 100644
--- a/gcc/fortran/intrinsic.c
+++ b/gcc/fortran/intrinsic.c
@@ -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;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 2dc3dd9..fc1bccc 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2009-05-08 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/39876
+ * gfortran.dg/intrinsic_3.f90: New.
+
2009-05-07 Janis Johnson <janis187@us.ibm.com>
PR c/39037
diff --git a/gcc/testsuite/gfortran.dg/intrinsic_3.f90 b/gcc/testsuite/gfortran.dg/intrinsic_3.f90
new file mode 100644
index 0000000..fcd40e94
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/intrinsic_3.f90
@@ -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" } }
+