diff mbox

[Fortran,pr70697,v1,Coarray] ICE on EVENT WAIT with array element UNTIL_COUNT argument

Message ID 20170113114044.2455c25f@vepi2
State New
Headers show

Commit Message

Andre Vehreschild Jan. 13, 2017, 10:40 a.m. UTC
Hi Jerry,

thanks again for the fast review. Committed as r244413.

Will backport to gcc-6 in about a week.

Regards,
	Andre

On Thu, 12 Jan 2017 10:12:24 -0800
Jerry DeLisle <jvdelisle@charter.net> wrote:

> On 01/12/2017 05:43 AM, Andre Vehreschild wrote:

> > Hi all,

> > 

> > *** this is no duplicate, but +1 in the PR#! ***

> > 

> > attached patch fixes the ICE by resolving the expression in UNTIL_COUNT

> > correctly. The ICE was caused by the array-specification in UNTIL_COUNT not

> > correctly set.

> > 

> > Bootstraps and regtests ok on x86_64-linux/F25. Ok for trunk and gcc-6?

> > 

> > - Andre

> >   

> 

> OK and thanks,

> 

> Jerry



-- 
Andre Vehreschild * Email: vehre ad gmx dot de

Comments

Andre Vehreschild Jan. 29, 2017, 2:48 p.m. UTC | #1
Hi all,

and here's the backport committed as r245015.

Regards,
	Andre

On Fri, 13 Jan 2017 11:40:44 +0100
Andre Vehreschild <vehre@gmx.de> wrote:

> Hi Jerry,

> 

> thanks again for the fast review. Committed as r244413.

> 

> Will backport to gcc-6 in about a week.

> 

> Regards,

> 	Andre

> 

> On Thu, 12 Jan 2017 10:12:24 -0800

> Jerry DeLisle <jvdelisle@charter.net> wrote:

> 

> > On 01/12/2017 05:43 AM, Andre Vehreschild wrote:  

> > > Hi all,

> > > 

> > > *** this is no duplicate, but +1 in the PR#! ***

> > > 

> > > attached patch fixes the ICE by resolving the expression in UNTIL_COUNT

> > > correctly. The ICE was caused by the array-specification in UNTIL_COUNT

> > > not correctly set.

> > > 

> > > Bootstraps and regtests ok on x86_64-linux/F25. Ok for trunk and gcc-6?

> > > 

> > > - Andre

> > >     

> > 

> > OK and thanks,

> > 

> > Jerry  

> 

> 



-- 
Andre Vehreschild * Email: vehre ad gmx dot deIndex: gcc/fortran/ChangeLog
===================================================================
--- gcc/fortran/ChangeLog	(Revision 245014)
+++ gcc/fortran/ChangeLog	(Arbeitskopie)
@@ -1,5 +1,14 @@
 2017-01-29  Andre Vehreschild  <vehre@gcc.gnu.org>
 
+	Backported from trunk
+	2017-01-13  Andre Vehreschild  <vehre@gcc.gnu.org>
+
+	PR fortran/70697
+	* resolve.c (resolve_lock_unlock_event): Resolve the expression for
+	event's until_count.
+
+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
Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c	(Revision 245014)
+++ gcc/fortran/resolve.c	(Arbeitskopie)
@@ -8840,10 +8840,13 @@
     return;
 
   /* Check for EVENT WAIT the UNTIL_COUNT.  */
-  if (code->op == EXEC_EVENT_WAIT && code->expr4
-      && (code->expr4->ts.type != BT_INTEGER || code->expr4->rank != 0))
-    gfc_error ("UNTIL_COUNT= argument at %L must be a scalar INTEGER "
-	       "expression", &code->expr4->where);
+  if (code->op == EXEC_EVENT_WAIT && code->expr4)
+    {
+      if (!gfc_resolve_expr (code->expr4) || code->expr4->ts.type != BT_INTEGER
+	  || code->expr4->rank != 0)
+	gfc_error ("UNTIL_COUNT= argument at %L must be a scalar INTEGER "
+		   "expression", &code->expr4->where);
+    }
 }
 
 
Index: gcc/testsuite/ChangeLog
===================================================================
--- gcc/testsuite/ChangeLog	(Revision 245014)
+++ gcc/testsuite/ChangeLog	(Arbeitskopie)
@@ -1,6 +1,14 @@
 2017-01-29  Andre Vehreschild  <vehre@gcc.gnu.org>
 
 	Backport from trunk
+	2017-01-13  Andre Vehreschild  <vehre@gcc.gnu.org>
+
+	PR fortran/70697
+	* gfortran.dg/coarray/event_4.f08: New test.
+
+2017-01-29  Andre Vehreschild  <vehre@gcc.gnu.org>
+
+	Backport from trunk
 	2017-01-19  Andre Vehreschild  <vehre@gcc.gnu.org>
 
 	PR fortran/70696
Index: gcc/testsuite/gfortran.dg/coarray/event_4.f08
===================================================================
--- gcc/testsuite/gfortran.dg/coarray/event_4.f08	(nicht existent)
+++ gcc/testsuite/gfortran.dg/coarray/event_4.f08	(Arbeitskopie)
@@ -0,0 +1,12 @@
+! { dg-do run }
+!
+! Check that pr 70697 is fixed.
+
+program event_4
+  use iso_fortran_env
+  integer :: nc(1)
+  type(event_type) done[*]
+  nc(1) = 1
+  event post(done[1])
+  event wait(done,until_count=nc(1))
+end

diff mbox

Patch

Index: gcc/fortran/ChangeLog
===================================================================
--- gcc/fortran/ChangeLog	(Revision 244409)
+++ gcc/fortran/ChangeLog	(Arbeitskopie)
@@ -1,5 +1,11 @@ 
 2017-01-13  Andre Vehreschild  <vehre@gcc.gnu.org>
 
+	PR fortran/70697
+	* resolve.c (resolve_lock_unlock_event): Resolve the expression for
+	event's until_count.
+
+2017-01-13  Andre Vehreschild  <vehre@gcc.gnu.org>
+
 	PR fortran/70696
 	* trans-expr.c (gfc_get_tree_for_caf_expr): Ensure the backend_decl
 	is valid before accessing it.
Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c	(Revision 244409)
+++ gcc/fortran/resolve.c	(Arbeitskopie)
@@ -9158,10 +9158,13 @@ 
     return;
 
   /* Check for EVENT WAIT the UNTIL_COUNT.  */
-  if (code->op == EXEC_EVENT_WAIT && code->expr4
-      && (code->expr4->ts.type != BT_INTEGER || code->expr4->rank != 0))
-    gfc_error ("UNTIL_COUNT= argument at %L must be a scalar INTEGER "
-	       "expression", &code->expr4->where);
+  if (code->op == EXEC_EVENT_WAIT && code->expr4)
+    {
+      if (!gfc_resolve_expr (code->expr4) || code->expr4->ts.type != BT_INTEGER
+	  || code->expr4->rank != 0)
+	gfc_error ("UNTIL_COUNT= argument at %L must be a scalar INTEGER "
+		   "expression", &code->expr4->where);
+    }
 }
 
 
Index: gcc/testsuite/ChangeLog
===================================================================
--- gcc/testsuite/ChangeLog	(Revision 244409)
+++ gcc/testsuite/ChangeLog	(Arbeitskopie)
@@ -1,5 +1,10 @@ 
 2017-01-13  Andre Vehreschild  <vehre@gcc.gnu.org>
 
+	PR fortran/70697
+	* gfortran.dg/coarray/event_4.f08: New test.
+
+2017-01-13  Andre Vehreschild  <vehre@gcc.gnu.org>
+
 	PR fortran/70696
 	* gfortran.dg/coarray/event_3.f08: New test.
 
Index: gcc/testsuite/gfortran.dg/coarray/event_4.f08
===================================================================
--- gcc/testsuite/gfortran.dg/coarray/event_4.f08	(nicht existent)
+++ gcc/testsuite/gfortran.dg/coarray/event_4.f08	(Arbeitskopie)
@@ -0,0 +1,12 @@ 
+! { dg-do run }
+!
+! Check that pr 70697 is fixed.
+
+program event_4
+  use iso_fortran_env
+  integer :: nc(1)
+  type(event_type) done[*]
+  nc(1) = 1
+  event post(done[1])
+  event wait(done,until_count=nc(1))
+end