From: Paul Thomas Date: Sat, 30 Jan 2016 17:44:56 +0000 (+0000) Subject: re PR fortran/69566 ([OOP] Failure of SELECT TYPE with unlimited polymorphic function... X-Git-Tag: basepoints/gcc-7~1204 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e520d5f02a0cfa5d07a48a14f2b67af63884e9ed;p=thirdparty%2Fgcc.git 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 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 386bd4202814..e4401f7040b7 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 c5ae4c53910d..74f519ed87bc 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 3bea4af000f1..df468e11db8d 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 000000000000..0eb9c7a76f6b --- /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