diff mbox

[Fortran] PR 63363: No diagnostic for passing function as actual argument to KIND

Message ID CAKwh3qhuqoL+Joc7PcRPfrNAWjA8hSf_HhocpWPSxNFqx86W2g@mail.gmail.com
State New
Headers show

Commit Message

Janus Weil Dec. 22, 2014, 3:48 p.m. UTC
Hi all,

here is a small patch which enhances the diagnostics for the intrinsic
KIND function. Regtested on x86_64-unknown-linux-gnu. Ok for trunk?

Cheers,
Janus



2014-12-22  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/63363
    * check.c (gfc_check_kind): Reject polymorphic and non-data arguments.

2014-12-22  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/63363
    * gfortran.dg/kind_1.f90: New.

Comments

Steve Kargl Dec. 22, 2014, 5:33 p.m. UTC | #1
On Mon, Dec 22, 2014 at 04:48:02PM +0100, Janus Weil wrote:
> 
> here is a small patch which enhances the diagnostics for the intrinsic
> KIND function. Regtested on x86_64-unknown-linux-gnu. Ok for trunk?
> 
> Cheers,
> Janus
> 
> 
> 2014-12-22  Janus Weil  <janus@gcc.gnu.org>
> 
>     PR fortran/63363
>     * check.c (gfc_check_kind): Reject polymorphic and non-data arguments.
> 
> 2014-12-22  Janus Weil  <janus@gcc.gnu.org>
> 
>     PR fortran/63363
>     * gfortran.dg/kind_1.f90: New.


OK.
Janus Weil Dec. 22, 2014, 6:16 p.m. UTC | #2
>> here is a small patch which enhances the diagnostics for the intrinsic
>> KIND function. Regtested on x86_64-unknown-linux-gnu. Ok for trunk?
>
> OK.

Thanks, committed as r219027.

Cheers,
Janus
diff mbox

Patch

Index: gcc/fortran/check.c
===================================================================
--- gcc/fortran/check.c	(Revision 219014)
+++ gcc/fortran/check.c	(Arbeitskopie)
@@ -2531,13 +2531,20 @@  gfc_check_kill_sub (gfc_expr *pid, gfc_expr *sig,
 bool
 gfc_check_kind (gfc_expr *x)
 {
-  if (x->ts.type == BT_DERIVED)
+  if (x->ts.type == BT_DERIVED || x->ts.type == BT_CLASS)
     {
-      gfc_error ("%qs argument of %qs intrinsic at %L must be a "
-		 "non-derived type", gfc_current_intrinsic_arg[0]->name,
+      gfc_error ("%qs argument of %qs intrinsic at %L must be of "
+		 "intrinsic type", gfc_current_intrinsic_arg[0]->name,
 		 gfc_current_intrinsic, &x->where);
       return false;
     }
+  if (x->ts.type == BT_PROCEDURE)
+    {
+      gfc_error ("%qs argument of %qs intrinsic at %L must be a data entity",
+		 gfc_current_intrinsic_arg[0]->name, gfc_current_intrinsic,
+		 &x->where);
+      return false;
+    }
 
   return true;
 }