From b2acf594606e2ad30b325e7dde4380285ed23fdb Mon Sep 17 00:00:00 2001 From: Paul Thomas Date: Sat, 5 Sep 2009 14:20:51 +0000 Subject: [PATCH] re PR fortran/41258 (internal compiler error: in find_typebound_proc_uop, at fortran/symbol.c:4575) 2009-09-05 Paul Thomas PR fortran/41258 * primary.c (gfc_match_varspec): Do not look for typebound procedures unless the derived type has a f2k_derived namespace. 2009-09-05 Paul Thomas PR fortran/41258 * gfortran.dg/typebound_proc_12.f90 : New test. From-SVN: r151451 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/primary.c | 6 +++++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/typebound_proc_12.f90 | 12 ++++++++++++ 4 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/typebound_proc_12.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index aeae2835f3a9..c392d9d5666d 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2009-09-05 Paul Thomas + + PR fortran/41258 + * primary.c (gfc_match_varspec): Do not look for typebound + procedures unless the derived type has a f2k_derived namespace. + 2009-09-03 Diego Novillo * f95-lang.c (lang_hooks): Remove const qualifier. diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c index 267819c69f65..f25de2397bf6 100644 --- a/gcc/fortran/primary.c +++ b/gcc/fortran/primary.c @@ -1783,7 +1783,11 @@ gfc_match_varspec (gfc_expr *primary, int equiv_flag, bool sub_flag, if (m != MATCH_YES) return MATCH_ERROR; - tbp = gfc_find_typebound_proc (sym, &t, name, false, &gfc_current_locus); + if (sym->f2k_derived) + tbp = gfc_find_typebound_proc (sym, &t, name, false, &gfc_current_locus); + else + tbp = NULL; + if (tbp) { gfc_symbol* tbp_sym; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 57ddbac05ba9..cd4617183bb7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-09-05 Paul Thomas + + PR fortran/41258 + * gfortran.dg/typebound_proc_12.f90 : New test. + 2009-09-04 Alexandre Oliva PR debug/41225 diff --git a/gcc/testsuite/gfortran.dg/typebound_proc_12.f90 b/gcc/testsuite/gfortran.dg/typebound_proc_12.f90 new file mode 100644 index 000000000000..4612d4982f3b --- /dev/null +++ b/gcc/testsuite/gfortran.dg/typebound_proc_12.f90 @@ -0,0 +1,12 @@ +! { dg-do compile } +! Test the fix for PR41258, where an ICE was caused by a search +! for a typebound procedure to resolve d%c%e +! +! Contributed by Joost VandeVondele +! + TYPE a + TYPE(b), DIMENSION(:), POINTER :: c ! { dg-error "type that has not been declared" } + END TYPE + TYPE(a), POINTER :: d + CALL X(d%c%e) ! { dg-error "before it is defined" } +end -- 2.47.2