]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/69566 ([OOP] Failure of SELECT TYPE with unlimited polymorphic function...
authorPaul Thomas <pault@gcc.gnu.org>
Sat, 30 Jan 2016 17:44:56 +0000 (17:44 +0000)
committerPaul Thomas <pault@gcc.gnu.org>
Sat, 30 Jan 2016 17:44:56 +0000 (17:44 +0000)
2016-01-30  Paul Thomas  <pault@gcc.gnu.org>

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  <pault@gcc.gnu.org>

PR fortran/69566
* gfortran.dg/unlimited_polymorphic_25.f03: New test.

From-SVN: r233011

gcc/fortran/ChangeLog
gcc/fortran/trans-expr.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/unlimited_polymorphic_25.f03 [new file with mode: 0644]

index 386bd42028140990cbeadd9326a920165ba71ff7..e4401f7040b780758718829cc225a5de7978f1c5 100644 (file)
@@ -1,3 +1,9 @@
+2016-01-30  Paul Thomas  <pault@gcc.gnu.org>
+
+       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  <vehre@gcc.gnu.org>
 
        PR fortran/62536
index c5ae4c53910dcc150d13b1e01fae48383fed3b91..74f519ed87bce23033b2f1f5d5bc8d3373297bf5 100644 (file)
@@ -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;
index 3bea4af000f1c48a2f9b796f2a10c29598cdfbd2..df468e11db8d0cb25bada8eb8483b249085f18c6 100644 (file)
@@ -1,3 +1,8 @@
+2016-01-30  Paul Thomas  <pault@gcc.gnu.org>
+
+       PR fortran/69566
+       * gfortran.dg/unlimited_polymorphic_25.f03: New test.
+
 2016-01-30  Martin Sebor  <msebor@redhat.com>
 
        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 (file)
index 0000000..0eb9c7a
--- /dev/null
@@ -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  <janus@gcc.gnu.org>
+!
+  print *, associated(return_pointer()) ! ICE
+contains
+  function return_pointer()
+    class(*), pointer :: return_pointer(:)
+  end function
+end