------- Comment #4 from dfranke at gcc dot gnu dot org  2007-05-18 12:46 -------
F95, section 12.3.2.3, INTRINSIC statement:
R1209 intrinsic-stmt   is    INTRINSIC [ :: ] intrinsic-procedure-name-list
Constraint:  Each intrinsic-procedure-name shall be the name of an intrinsic
procedure.

This doesn't mention any types at all. In addition, only SUN warns about a
superfluous type here:

$> ifort -warn all pr20373.f90        # no message
$> sunf95 -w3 pr20373.f90

integer, intrinsic :: dsqrt
                      ^
"pr20373.f90", Line = 1, Column = 23: CAUTION: The type statement for generic
intrinsic function DSQRT is ignored.


Following this, following patch emits a warning if std=gnu and an error if
std=f95|f2203 (not regtested). The wording of the msg could be improved ...

Index: resolve.c
===================================================================
--- resolve.c   (revision 124790)
+++ resolve.c   (working copy)
@@ -6400,6 +6400,12 @@
       && !gfc_intrinsic_name(sym->name, 1))
     gfc_error("Intrinsic at %L does not exist", &sym->declared_at);

+  /* Due to F95, 12.3.2.3, INTRINSIC statements shall have no type.  */
+  if (sym->attr.intrinsic && sym->ts.type != BT_UNKNOWN)
+    gfc_notify_std(GFC_STD_LEGACY | GFC_STD_GNU,
+                  "Intrinsic at %L shall not have a type specifier",
+                  &sym->declared_at);
+
   /* Resolve array specifier. Check as well some constraints
      on COMMON blocks.  */


$> gfortran-svn -g -Wall -std=gnu pr20373.f90
pr20373.f90:1.27:

integer, intrinsic :: dsqrt
                          1
Warning: Intrinsic at (1) shall not have a type specifier


-- 

dfranke at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dfranke at gcc dot gnu dot
                   |                            |org
           Keywords|                            |diagnostic, patch
      Known to fail|                            |4.2.1 4.3.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20373

Reply via email to