From ee3bea0b28549727df923754c8d5e9590f53bba2 Mon Sep 17 00:00:00 2001 From: Janus Weil Date: Tue, 4 Sep 2012 10:03:09 +0200 Subject: re PR fortran/54435 (ICE with SELECT TYPE on a non-CLASS object) 2012-09-04 Janus Weil PR fortran/54435 PR fortran/54443 * match.c (gfc_match_select_type): Make sure to only access CLASS_DATA for BT_CLASS. 2012-09-04 Janus Weil PR fortran/54243 PR fortran/54244 * gfortran.dg/select_type_29.f03: New. From-SVN: r190910 --- gcc/fortran/ChangeLog | 7 +++++++ gcc/fortran/match.c | 4 ++-- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gfortran.dg/select_type_29.f03 | 26 ++++++++++++++++++++++++++ 4 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/select_type_29.f03 (limited to 'gcc') diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index c1de983..dbafc44 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2012-09-04 Janus Weil + + PR fortran/54435 + PR fortran/54443 + * match.c (gfc_match_select_type): Make sure to only access CLASS_DATA + for BT_CLASS. + 2012-09-03 Tobias Burnus PR fortran/54467 diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c index 4c713a5..cf85d52 100644 --- a/gcc/fortran/match.c +++ b/gcc/fortran/match.c @@ -5368,10 +5368,10 @@ gfc_match_select_type (void) array, which can have a reference, from other expressions that have references, such as derived type components, and are not allowed by the standard. - TODO; see is it is sufficient to exclude component and substring + TODO: see if it is sufficient to exclude component and substring references. */ class_array = expr1->expr_type == EXPR_VARIABLE - && expr1->ts.type != BT_UNKNOWN + && expr1->ts.type == BT_CLASS && CLASS_DATA (expr1) && (strcmp (CLASS_DATA (expr1)->name, "_data") == 0) && (CLASS_DATA (expr1)->attr.dimension diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2a24cbc..163eeab 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2012-09-04 Janus Weil + + PR fortran/54243 + PR fortran/54244 + * gfortran.dg/select_type_29.f03: New. + 2012-09-03 Marc Glisse * gcc.dg/fold-perm.c: Improve test. diff --git a/gcc/testsuite/gfortran.dg/select_type_29.f03 b/gcc/testsuite/gfortran.dg/select_type_29.f03 new file mode 100644 index 0000000..71603e3 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/select_type_29.f03 @@ -0,0 +1,26 @@ +! { dg-do compile } +! +! PR 54435: [4.7/4.8 Regression] ICE with SELECT TYPE on a non-CLASS object +! +! Contributed by xarthisius + +subroutine foo(x) + integer :: x + select type (x) ! { dg-error "Selector shall be polymorphic" } + end select +end + + +! PR 54443: [4.7/4.8 Regression] Segmentation Fault when Compiling for code using Fortran Polymorphic Entities +! +! Contributed by Mark Beyer + +program class_test + type hashnode + character(4) :: htype + end type + class(hashnode), pointer :: hp + + select type(hp%htype) ! { dg-error "is not a named variable" } + +end program -- cgit v1.1