* [OpenACC] Don't restrict ACC wait arguments to constants in fortran
@ 2017-09-21 14:06 Cesar Philippidis
0 siblings, 0 replies; only message in thread
From: Cesar Philippidis @ 2017-09-21 14:06 UTC (permalink / raw)
To: gcc-patches, Fortran List
[-- Attachment #1: Type: text/plain, Size: 355 bytes --]
I noticed that gfortran complains when the integer wait queue argument
for the acc wait directive is not a constant value. That's an odd
restriction, that not even the wait clause enforces. Considering that
this patch is one-liner, I've committed this patch to trunk as obvious
to remove this restriction.
I'll backport this patch to og7 shortly.
Cesar
[-- Attachment #2: trunk-oacc-wait.diff --]
[-- Type: text/x-patch, Size: 1251 bytes --]
2017-09-21 Cesar Philippidis <cesar@codesourcery.com>
gcc/fortran/
* openmp.c (gfc_match_oacc_wait): Don't restrict wait directive
arguments to constant integers.
gcc/testsuite/
* gfortran.dg/goacc/wait.f90: New test.
diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c
index 8400354181c..c5e00888bbe 100644
--- a/gcc/fortran/openmp.c
+++ b/gcc/fortran/openmp.c
@@ -2185,8 +2185,7 @@ gfc_match_oacc_wait (void)
}
if (!gfc_resolve_expr (el->expr)
- || el->expr->ts.type != BT_INTEGER || el->expr->rank != 0
- || el->expr->expr_type != EXPR_CONSTANT)
+ || el->expr->ts.type != BT_INTEGER || el->expr->rank != 0)
{
gfc_error ("WAIT clause at %L requires a scalar INTEGER expression",
&el->expr->where);
diff --git a/gcc/testsuite/gfortran.dg/goacc/wait.f90 b/gcc/testsuite/gfortran.dg/goacc/wait.f90
new file mode 100644
index 00000000000..9cdbcdf822e
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/goacc/wait.f90
@@ -0,0 +1,12 @@
+! Ensure that ACC WAIT accept integer arguments.
+
+subroutine foo (wqueue)
+ implicit none
+ integer :: wqueue, waitno
+ integer, parameter :: waitp = 100
+
+ !$acc wait (wqueue)
+ !$acc wait (waitno)
+ !$acc wait (waitp)
+ !$acc wait (0)
+end subroutine foo
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-09-21 14:06 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-21 14:06 [OpenACC] Don't restrict ACC wait arguments to constants in fortran Cesar Philippidis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).