This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, Fortran, pr70696, gcc-6, v1-3] [Coarray] ICE on EVENT POST of host-associated EVENT_TYPE coarray


Hi all,

just applied the backport to gcc-6 as promised as r245014.

Regards,
	Andre

On Thu, 19 Jan 2017 16:53:14 +0100
Andre Vehreschild <vehre@gmx.de> wrote:

> Hi Steve,
> 
> thanks for the review. Committed as r244637.
> 
> Regards,
> 	Andre
> 
> On Thu, 19 Jan 2017 06:51:19 -0800
> Steve Kargl <sgk@troutmask.apl.washington.edu> wrote:
> 
> > On Thu, Jan 19, 2017 at 01:07:50PM +0100, Andre Vehreschild wrote:  
> > > Hi all,
> > > 
> > > unfortunately triggered this patch a regression in the opencoarray's
> > > testsuite, which also occurs outside of opencoarray, when a caf-function
> > > is used in a block in the main-program. This patch fixes the error and
> > > adds a testcase.
> > > 
> > > Bootstrapped and regtested ok on x86_64-linux/f25. Ok for trunk?
> > >     
> > 
> > Yes.
> >   
> 
> 


-- 
Andre Vehreschild * Email: vehre ad gmx dot de 
Index: gcc/fortran/ChangeLog
===================================================================
--- gcc/fortran/ChangeLog	(Revision 245013)
+++ gcc/fortran/ChangeLog	(Arbeitskopie)
@@ -1,3 +1,13 @@
+2017-01-29  Andre Vehreschild  <vehre@gcc.gnu.org>
+
+	Backport from trunk
+	PR fortran/70696
+	* trans-expr.c (gfc_get_tree_for_caf_expr): Ensure the backend_decl
+	is valid before accessing it.  Remove unnecessary assert.
+	* trans-decl.c (gfc_build_qualified_array): Add static tokens to the
+	parent function's scope only, when the decl-context is not the
+	translation unit.
+
 2017-01-17  Jakub Jelinek  <jakub@redhat.com>
 
 	Backported from mainline
Index: gcc/fortran/trans-decl.c
===================================================================
--- gcc/fortran/trans-decl.c	(Revision 245013)
+++ gcc/fortran/trans-decl.c	(Arbeitskopie)
@@ -887,6 +887,10 @@
 	  DECL_CONTEXT (token) = sym->ns->proc_name->backend_decl;
 	  gfc_module_add_decl (cur_module, token);
 	}
+      else if (sym->attr.host_assoc
+	       && TREE_CODE (DECL_CONTEXT (current_function_decl))
+	       != TRANSLATION_UNIT_DECL)
+	gfc_add_decl_to_parent_function (token);
       else
 	gfc_add_decl_to_function (token);
     }
Index: gcc/fortran/trans-expr.c
===================================================================
--- gcc/fortran/trans-expr.c	(Revision 245013)
+++ gcc/fortran/trans-expr.c	(Arbeitskopie)
@@ -1898,8 +1898,11 @@
 		     &expr->where);
     }
 
-  caf_decl = expr->symtree->n.sym->backend_decl;
-  gcc_assert (caf_decl);
+  /* Make sure the backend_decl is present before accessing it.  */
+  caf_decl = expr->symtree->n.sym->backend_decl == NULL_TREE
+      ? gfc_get_symbol_decl (expr->symtree->n.sym)
+      : expr->symtree->n.sym->backend_decl;
+
   if (expr->symtree->n.sym->ts.type == BT_CLASS)
     caf_decl = gfc_class_data_get (caf_decl);
   if (expr->symtree->n.sym->attr.codimension)
Index: gcc/testsuite/ChangeLog
===================================================================
--- gcc/testsuite/ChangeLog	(Revision 245013)
+++ gcc/testsuite/ChangeLog	(Arbeitskopie)
@@ -1,3 +1,21 @@
+2017-01-29  Andre Vehreschild  <vehre@gcc.gnu.org>
+
+	Backport from trunk
+	2017-01-19  Andre Vehreschild  <vehre@gcc.gnu.org>
+
+	PR fortran/70696
+	* gfortran.dg/coarray_43.f90: New test.
+
+	2017-01-18  Andre Vehreschild  <vehre@gcc.gnu.org>
+
+	PR fortran/70696
+	* gfortran.dg/coarray_event_1.f08: New test.
+
+	2017-01-13  Andre Vehreschild  <vehre@gcc.gnu.org>
+
+	PR fortran/70696
+	* gfortran.dg/coarray/event_3.f08: New test.
+
 2017-01-28  John David Anglin  <danglin@gcc.gnu.org>
 
 	PR testsuite/70583
Index: gcc/testsuite/gfortran.dg/coarray/event_3.f08
===================================================================
--- gcc/testsuite/gfortran.dg/coarray/event_3.f08	(nicht existent)
+++ gcc/testsuite/gfortran.dg/coarray/event_3.f08	(Arbeitskopie)
@@ -0,0 +1,20 @@
+! { dg-do run }
+!
+! Check PR fortran/70696 is fixed.
+
+program global_event
+  use iso_fortran_env , only : event_type
+  implicit none
+  type(event_type) :: x[*]
+  
+  call exchange
+  contains
+    subroutine exchange
+      integer :: cnt
+      event post(x[1])
+      event post(x[1])
+      call event_query(x, cnt)
+      if (cnt /= 2) error stop 1
+      event wait(x, until_count=2)
+    end subroutine
+end 
Index: gcc/testsuite/gfortran.dg/coarray_43.f90
===================================================================
--- gcc/testsuite/gfortran.dg/coarray_43.f90	(nicht existent)
+++ gcc/testsuite/gfortran.dg/coarray_43.f90	(Arbeitskopie)
@@ -0,0 +1,13 @@
+! { dg-do link }
+! { dg-options "-fcoarray=lib -lcaf_single" }
+
+program coarray_43
+  implicit none
+  integer, parameter :: STR_LEN = 50
+  character(len=STR_LEN) :: str[*]
+  integer :: pos
+  write(str,"(2(a,i2))") "Greetings from image ",this_image()," of ",num_images()
+  block
+    pos = scan(str[5], set="123456789")
+  end block
+end program
Index: gcc/testsuite/gfortran.dg/coarray_event_1.f08
===================================================================
--- gcc/testsuite/gfortran.dg/coarray_event_1.f08	(nicht existent)
+++ gcc/testsuite/gfortran.dg/coarray_event_1.f08	(Arbeitskopie)
@@ -0,0 +1,15 @@
+! { dg-do compile }
+! { dg-options "-fcoarray=lib -lcaf_single" }
+
+! Check that pr70696 is really fixed.
+
+  use iso_fortran_env
+  type(event_type) :: x[*]
+
+  ! exchange must not be called or the link problem before the patch
+  ! does not occur.
+contains
+  subroutine exchange
+    event post (x[1])
+  end subroutine
+end 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]