From e520d5f02a0cfa5d07a48a14f2b67af63884e9ed Mon Sep 17 00:00:00 2001 From: Paul Thomas Date: Sat, 30 Jan 2016 17:44:56 +0000 Subject: [PATCH] re PR fortran/69566 ([OOP] Failure of SELECT TYPE with unlimited polymorphic function result) 2016-01-30 Paul Thomas PR fortran/69566 * trans-expr.c (gfc_conv_procedure_call): Correct expression for 'ulim_copy', which was missing a test for 'comp'. 2016-01-30 Paul Thomas PR fortran/69566 * gfortran.dg/unlimited_polymorphic_25.f03: New test. From-SVN: r233011 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/trans-expr.c | 5 +++-- gcc/testsuite/ChangeLog | 5 +++++ .../gfortran.dg/unlimited_polymorphic_25.f03 | 14 ++++++++++++++ 4 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/unlimited_polymorphic_25.f03 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 386bd420281..e4401f7040b 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2016-01-30 Paul Thomas + + PR fortran/69566 + * trans-expr.c (gfc_conv_procedure_call): Correct expression + for 'ulim_copy', which was missing a test for 'comp'. + 2016-01-28 Andre Vehreschild PR fortran/62536 diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index c5ae4c53910..74f519ed87b 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -4723,8 +4723,9 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym, is the third and fourth argument to such a function call a value denoting the number of elements to copy (i.e., most of the time the length of a deferred length string). */ - ulim_copy = formal == NULL && UNLIMITED_POLY (sym) - && strcmp ("_copy", comp->name) == 0; + ulim_copy = (formal == NULL) + && UNLIMITED_POLY (sym) + && comp && (strcmp ("_copy", comp->name) == 0); /* Evaluate the arguments. */ for (arg = args, argc = 0; arg != NULL; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3bea4af000f..df468e11db8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-01-30 Paul Thomas + + PR fortran/69566 + * gfortran.dg/unlimited_polymorphic_25.f03: New test. + 2016-01-30 Martin Sebor PR c++/68490 diff --git a/gcc/testsuite/gfortran.dg/unlimited_polymorphic_25.f03 b/gcc/testsuite/gfortran.dg/unlimited_polymorphic_25.f03 new file mode 100644 index 00000000000..0eb9c7a76f6 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/unlimited_polymorphic_25.f03 @@ -0,0 +1,14 @@ +! { dg-do compile } +! +! Tests the fix for PR69566, in which a boolean expression testing a +! the component of a pointer did not check the pointer, resulting in +! the ICE. +! +! Contributed by Janus Weil +! + print *, associated(return_pointer()) ! ICE +contains + function return_pointer() + class(*), pointer :: return_pointer(:) + end function +end