re PR fortran/70697 ([Coarray] ICE on EVENT WAIT with array element UNTIL_COUNT argument)
authorAndre Vehreschild <vehre@gcc.gnu.org>
Fri, 13 Jan 2017 10:39:52 +0000 (11:39 +0100)
committerAndre Vehreschild <vehre@gcc.gnu.org>
Fri, 13 Jan 2017 10:39:52 +0000 (11:39 +0100)
gcc/testsuite/ChangeLog:

2017-01-13  Andre Vehreschild  <vehre@gcc.gnu.org>

PR fortran/70697
* gfortran.dg/coarray/event_4.f08: New test.

gcc/fortran/ChangeLog:

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.

From-SVN: r244413

gcc/fortran/ChangeLog
gcc/fortran/resolve.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/coarray/event_4.f08 [new file with mode: 0644]

index e979a3082392ec570b9933d33e4ef816dbc9a018..191bfc816a71178eb4e1de04bcf672233a2dfb08 100644 (file)
@@ -1,3 +1,9 @@
+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
index a75d5feb8f6046afcb6c952a7f0677107ffdeb0e..a5fe2314372c702c92e0304c5cd57ecd2de3faa3 100644 (file)
@@ -9158,10 +9158,13 @@ resolve_lock_unlock_event (gfc_code *code)
     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 df14a1bc3350eee5614d56f2e5b7e227eb7b156c..3a6fcfc2356c7e419eda9ab0c27e7352c9f5a5e8 100644 (file)
@@ -1,3 +1,8 @@
+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
diff --git a/gcc/testsuite/gfortran.dg/coarray/event_4.f08 b/gcc/testsuite/gfortran.dg/coarray/event_4.f08
new file mode 100644 (file)
index 0000000..de901c0
--- /dev/null
@@ -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