* [Patch, Fortran] PR 63363: No diagnostic for passing function as actual argument to KIND
@ 2014-12-22 16:00 Janus Weil
2014-12-22 17:41 ` Steve Kargl
0 siblings, 1 reply; 3+ messages in thread
From: Janus Weil @ 2014-12-22 16:00 UTC (permalink / raw)
To: gfortran, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 409 bytes --]
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.
[-- Attachment #2: pr63363.diff --]
[-- Type: text/plain, Size: 957 bytes --]
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;
}
[-- Attachment #3: kind_1.f90 --]
[-- Type: text/x-fortran, Size: 608 bytes --]
! { dg-do compile }
!
! PR 63363: No diagnostic for passing function as actual argument to KIND
!
! Contributed by Ian Harvey <ian_harvey@bigpond.com>
type :: t
end type
type(t) :: d
class(*), allocatable :: c
print *, KIND(d) ! { dg-error "must be of intrinsic type" }
print *, KIND(c) ! { dg-error "must be of intrinsic type" }
print *, KIND(f) ! { dg-error "must be a data entity" }
print *, KIND(f())
print *, KIND(s) ! { dg-error "must be a data entity" }
contains
FUNCTION f()
INTEGER(SELECTED_INT_KIND(4)) :: f
END FUNCTION
subroutine s
end subroutine
END
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Patch, Fortran] PR 63363: No diagnostic for passing function as actual argument to KIND
2014-12-22 16:00 [Patch, Fortran] PR 63363: No diagnostic for passing function as actual argument to KIND Janus Weil
@ 2014-12-22 17:41 ` Steve Kargl
2014-12-22 18:25 ` Janus Weil
0 siblings, 1 reply; 3+ messages in thread
From: Steve Kargl @ 2014-12-22 17:41 UTC (permalink / raw)
To: Janus Weil; +Cc: gfortran, gcc-patches
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.
--
Steve
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Patch, Fortran] PR 63363: No diagnostic for passing function as actual argument to KIND
2014-12-22 17:41 ` Steve Kargl
@ 2014-12-22 18:25 ` Janus Weil
0 siblings, 0 replies; 3+ messages in thread
From: Janus Weil @ 2014-12-22 18:25 UTC (permalink / raw)
To: Steve Kargl; +Cc: gfortran, gcc-patches
>> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-12-22 18:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-22 16:00 [Patch, Fortran] PR 63363: No diagnostic for passing function as actual argument to KIND Janus Weil
2014-12-22 17:41 ` Steve Kargl
2014-12-22 18:25 ` Janus Weil
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).