diff mbox

[Fortran,caf] Add unimplemented message for polymorphic objects with allocatable/pointer components

Message ID 20161014105256.0f7233f5@vepi2
State New
Headers show

Commit Message

Andre Vehreschild Oct. 14, 2016, 8:52 a.m. UTC
Hi all,

commited as r241150.

Regards,
	Andre

On Thu, 13 Oct 2016 17:45:08 +0200
Andre Vehreschild <vehre@gmx.de> wrote:

> Hi all,
> 
> attached patch adds an unimplemented message, when a polymorphic coarray
> object with allocatable/pointer components is declared for coarray mode
> library. This is just an ad-hoc solution until handling those constructs is
> implemented. There are already some prs that address ICEs caused by this
> issue: 77961, 77785.
> 
> Bootstrapped and regtests ok on x86_64-linux/F23. May have some fuzz when the
> patch for polymorphic assign:
> 
> https://gcc.gnu.org/ml/fortran/2016-10/msg00091.html
> 
> is not present. The polymorphic assign patch is not necessary for this patch.
> 
> If no one objects, I will commit tomorrow morning.
> 
> Regards,
> 	Andre
diff mbox

Patch

Index: gcc/fortran/ChangeLog
===================================================================
--- gcc/fortran/ChangeLog	(Revision 241149)
+++ gcc/fortran/ChangeLog	(Arbeitskopie)
@@ -1,3 +1,8 @@ 
+2016-10-14  Andre Vehreschild  <vehre@gcc.gnu.org>
+
+	* resolve.c (resolve_symbol): Add unimplemented message for
+	polymorphic types with allocatable/pointer components and coarray=lib.
+
 2016-10-13  Thomas Preud'homme  <thomas.preudhomme@arm.com>
 
 	* trans-intrinsic.c: Include memmodel.h.
Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c	(Revision 241149)
+++ gcc/fortran/resolve.c	(Arbeitskopie)
@@ -13787,6 +13787,19 @@ 
      (just like derived type declaration symbols have flavor FL_DERIVED). */
   gcc_assert (sym->ts.type != BT_UNION);
 
+  /* Coarrayed polymorphic objects with allocatable or pointer components are
+     yet unsupported for -fcoarray=lib.  */
+  if (flag_coarray == GFC_FCOARRAY_LIB && sym->ts.type == BT_CLASS
+      && sym->ts.u.derived && CLASS_DATA (sym)
+      && CLASS_DATA (sym)->attr.codimension
+      && (sym->ts.u.derived->attr.alloc_comp
+	  || sym->ts.u.derived->attr.pointer_comp))
+    {
+      gfc_error ("Sorry, allocatable/pointer components in polymorphic (CLASS) "
+		 "type coarrays at %L are unsupported", &sym->declared_at);
+      return;
+    }
+
   if (sym->attr.artificial)
     return;
 
Index: gcc/testsuite/ChangeLog
===================================================================
--- gcc/testsuite/ChangeLog	(Revision 241149)
+++ gcc/testsuite/ChangeLog	(Arbeitskopie)
@@ -1,3 +1,7 @@ 
+2016-10-14  Andre Vehreschild  <vehre@gcc.gnu.org>
+
+	* gfortran.dg/coarray_38.f90: Expect error message.
+
 2016-10-14  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
 	* gcc.target/aarch64/spellcheck_1.c: New test.
Index: gcc/testsuite/gfortran.dg/coarray_38.f90
===================================================================
--- gcc/testsuite/gfortran.dg/coarray_38.f90	(Revision 241149)
+++ gcc/testsuite/gfortran.dg/coarray_38.f90	(Arbeitskopie)
@@ -71,7 +71,7 @@ 
 type t2
   class(t), allocatable :: caf2[:]
 end type t2
-class(t), allocatable :: caf[:]
+class(t), allocatable :: caf[:] ! { dg-error "Sorry, allocatable/pointer components in polymorphic" }
 type(t) :: x
 type(t2) :: y