This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, Fortran, pr70696, gcc-6, v1-3] [Coarray] ICE on EVENT POST of host-associated EVENT_TYPE coarray
- From: Andre Vehreschild <vehre at gmx dot de>
- To: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- Cc: GCC-Fortran-ML <fortran at gcc dot gnu dot org>, GCC-Patches-ML <gcc-patches at gcc dot gnu dot org>, Jakub Jelinek <jakub at redhat dot com>
- Date: Sun, 29 Jan 2017 14:51:03 +0100
- Subject: Re: [PATCH, Fortran, pr70696, gcc-6, v1-3] [Coarray] ICE on EVENT POST of host-associated EVENT_TYPE coarray
- Authentication-results: sourceware.org; auth=none
- References: <20170112124558.6f8de516@vepi2> <1605333b-0420-0527-d766-b37e3355e860@charter.net> <20170113112323.7aa27b42@vepi2> <20170118132639.70979112@vepi2> <4116785a-a0b1-fbaa-937a-229e241fe3c3@charter.net> <20170118193559.3058a85d@vepi2> <20170119130750.5a36dd5a@vepi2> <20170119145119.GA79750@troutmask.apl.washington.edu> <20170119165314.7e25de11@vepi2>
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
- References:
- [PATCH, Fortran, pr70696, v1] [Coarray] ICE on EVENT POST of host-associated EVENT_TYPE coarray
- Re: [PATCH, Fortran, pr70696, v1] [Coarray] ICE on EVENT POST of host-associated EVENT_TYPE coarray
- Re: [PATCH, Fortran, pr70696, v1] [Coarray] ICE on EVENT POST of host-associated EVENT_TYPE coarray
- [PATCH, Fortran, pr70696, v2] [Coarray] ICE on EVENT POST of host-associated EVENT_TYPE coarray
- Re: [PATCH, Fortran, pr70696, v2] [Coarray] ICE on EVENT POST of host-associated EVENT_TYPE coarray
- Re: [PATCH, Fortran, pr70696, v2] [Coarray] ICE on EVENT POST of host-associated EVENT_TYPE coarray
- Re: [PATCH, Fortran, pr70696, v2] [Coarray] ICE on EVENT POST of host-associated EVENT_TYPE coarray
- Re: [PATCH, Fortran, pr70696, v2] [Coarray] ICE on EVENT POST of host-associated EVENT_TYPE coarray
- Re: [PATCH, Fortran, pr70696, v2] [Coarray] ICE on EVENT POST of host-associated EVENT_TYPE coarray