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

2016-10-14 Thread Andre Vehreschild
Hi all,

commited as r241150.

Regards,
Andre

On Thu, 13 Oct 2016 17:45:08 +0200
Andre Vehreschild  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


-- 
Andre Vehreschild * Email: vehre ad gmx dot de 
Index: gcc/fortran/ChangeLog
===
--- gcc/fortran/ChangeLog	(Revision 241149)
+++ gcc/fortran/ChangeLog	(Arbeitskopie)
@@ -1,3 +1,8 @@
+2016-10-14  Andre Vehreschild  
+
+	* resolve.c (resolve_symbol): Add unimplemented message for
+	polymorphic types with allocatable/pointer components and coarray=lib.
+
 2016-10-13  Thomas Preud'homme  
 
 	* 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", >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  
+
+	* gfortran.dg/coarray_38.f90: Expect error message.
+
 2016-10-14  Kyrylo Tkachov  
 
 	* 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
 


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

2016-10-13 Thread Andre Vehreschild
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
-- 
Andre Vehreschild * Email: vehre ad gmx dot de 
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=caf_unimp.clog

gcc/testsuite/ChangeLog:

2016-10-13  Andre Vehreschild  

* gfortran.dg/coarray_38.f90: Expect error message.

gcc/fortran/ChangeLog:

2016-10-13  Andre Vehreschild  

* resolve.c (resolve_symbol): Add unimplemented message for
polymorphic types with allocatable/pointer components and coarray=lib.

diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 42e3421..2226227 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -13796,6 +13796,19 @@ resolve_symbol (gfc_symbol *sym)
  (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", >declared_at);
+  return;
+}
+
   if (sym->attr.artificial)
 return;
 
diff --git a/gcc/testsuite/gfortran.dg/coarray_38.f90 b/gcc/testsuite/gfortran.dg/coarray_38.f90
index 31155c5..c8011d4 100644
--- a/gcc/testsuite/gfortran.dg/coarray_38.f90
+++ b/gcc/testsuite/gfortran.dg/coarray_38.f90
@@ -71,7 +71,7 @@ end type t
 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