From c34d453f05d09ff166db25491a6901a7a40fba5b Mon Sep 17 00:00:00 2001 From: Janus Weil Date: Sun, 11 Jan 2015 20:13:24 +0100 Subject: [PATCH] re PR fortran/58023 ([F03] ICE on invalid with bad PPC declaration) 2015-01-11 Janus Weil PR fortran/58023 * resolve.c (resolve_fl_derived0): Set error flag if problems with the interface of a procedure-pointer component were detected. 2015-01-11 Janus Weil PR fortran/58023 * gfortran.dg/proc_ptr_comp_42.f90: New. From-SVN: r219439 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/resolve.c | 8 +++++--- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/proc_ptr_comp_42.f90 | 16 ++++++++++++++++ 4 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/proc_ptr_comp_42.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index b525ff40ba8..6f2e549c1b6 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2015-01-11 Janus Weil + + PR fortran/58023 + * resolve.c (resolve_fl_derived0): Set error flag if problems with the + interface of a procedure-pointer component were detected. + 2015-01-11 Janus Weil PR fortran/64508 diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index a0e32b1fa32..6b2444324f7 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -12424,9 +12424,11 @@ resolve_fl_derived0 (gfc_symbol *sym) { gfc_symbol *ifc = c->ts.interface; - if (!sym->attr.vtype - && !check_proc_interface (ifc, &c->loc)) - return false; + if (!sym->attr.vtype && !check_proc_interface (ifc, &c->loc)) + { + c->tb->error = 1; + return false; + } if (ifc->attr.if_source || ifc->attr.intrinsic) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a7c24ce0caa..4f729fd9569 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-01-11 Janus Weil + + PR fortran/58023 + * gfortran.dg/proc_ptr_comp_42.f90: New. + 2015-01-11 Janus Weil PR fortran/64508 diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_comp_42.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_comp_42.f90 new file mode 100644 index 00000000000..3773fae3952 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/proc_ptr_comp_42.f90 @@ -0,0 +1,16 @@ +! { dg-do compile } +! +! PR 58023: [F03] ICE on invalid with bad PPC declaration +! +! Contributed by Andrew Benson + + implicit none + + type :: sfd + procedure(mr), pointer :: mr2 ! { dg-error "must be explicit" } + end type + + type(sfd):: d + print *, d%mr2() + +end -- 2.30.2