public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] PR fortran/85895 -- Check for valid errmsg entity
@ 2018-05-23 23:45 Steve Kargl
  2018-05-24 20:14 ` Janus Weil
  0 siblings, 1 reply; 2+ messages in thread
From: Steve Kargl @ 2018-05-23 23:45 UTC (permalink / raw)
  To: fortran, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 500 bytes --]

The attach patch fixes PR fortran/85895 and also addresses
a nearby issue by resolving the expressions associated with
the STAT= and ERRMSG= tags in SYNC statements.  OK to commit?

2018-05-23  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/85895
	* resolve.c (resolve_sync): Resolve expression before checking for
	an error.

2018-05-23  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/85895

	* gfortran.dg/coarray_3.f90: Fix invalid testcase.
	* gfortran.dg/pr85895.f90: New test.

-- 
Steve

[-- Attachment #2: pr85895.diff --]
[-- Type: text/x-diff, Size: 2158 bytes --]

Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c	(revision 260623)
+++ gcc/fortran/resolve.c	(working copy)
@@ -9527,6 +9527,7 @@ resolve_sync (gfc_code *code)
     }
 
   /* Check STAT.  */
+  gfc_resolve_expr (code->expr2);
   if (code->expr2
       && (code->expr2->ts.type != BT_INTEGER || code->expr2->rank != 0
 	  || code->expr2->expr_type != EXPR_VARIABLE))
@@ -9534,6 +9535,7 @@ resolve_sync (gfc_code *code)
 	       &code->expr2->where);
 
   /* Check ERRMSG.  */
+  gfc_resolve_expr (code->expr3);
   if (code->expr3
       && (code->expr3->ts.type != BT_CHARACTER || code->expr3->rank != 0
 	  || code->expr3->expr_type != EXPR_VARIABLE))
Index: gcc/testsuite/gfortran.dg/coarray_3.f90
===================================================================
--- gcc/testsuite/gfortran.dg/coarray_3.f90	(revision 260623)
+++ gcc/testsuite/gfortran.dg/coarray_3.f90	(working copy)
@@ -13,7 +13,7 @@ end critical fkl ! { dg-error "Expecting END PROGRAM" 
 
 sync all (stat=1) ! { dg-error "Syntax error in SYNC ALL" }
 sync all ( stat = n,stat=k) ! { dg-error "Redundant STAT" }
-sync memory (errmsg=str)
+sync memory (errmsg=str) ! { dg-error "must be a scalar CHARACTER variable" }
 sync memory (errmsg=n) ! { dg-error "must be a scalar CHARACTER variable" }
 sync images (*, stat=1.0) ! { dg-error "Syntax error in SYNC IMAGES" }
 sync images (-1) ! { dg-error "must between 1 and num_images" }
Index: gcc/testsuite/gfortran.dg/pr85895.f90
===================================================================
--- gcc/testsuite/gfortran.dg/pr85895.f90	(nonexistent)
+++ gcc/testsuite/gfortran.dg/pr85895.f90	(working copy)
@@ -0,0 +1,17 @@
+! { dg-do compile }
+! { dg-options "-fcoarray=lib" }
+! PR fortran/85895
+subroutine p
+   character(80) :: c(2)
+   sync memory (errmsg=c)        ! { dg-error "scalar CHARACTER variable" }
+end subroutine p
+
+subroutine q
+   character(80) :: c(2)
+   sync memory (errmsg=c(1:2))   ! { dg-error "scalar CHARACTER variable" }
+end subroutine q
+
+subroutine r
+   character(80) :: c(2)
+   sync memory (errmsg=c(1))
+end subroutine r

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] PR fortran/85895 -- Check for valid errmsg entity
  2018-05-23 23:45 [PATCH] PR fortran/85895 -- Check for valid errmsg entity Steve Kargl
@ 2018-05-24 20:14 ` Janus Weil
  0 siblings, 0 replies; 2+ messages in thread
From: Janus Weil @ 2018-05-24 20:14 UTC (permalink / raw)
  To: Steve Kargl; +Cc: gfortran, gcc-patches

2018-05-24 1:45 GMT+02:00 Steve Kargl <sgk@troutmask.apl.washington.edu>:
> The attach patch fixes PR fortran/85895 and also addresses
> a nearby issue by resolving the expressions associated with
> the STAT= and ERRMSG= tags in SYNC statements.  OK to commit?

Looks good to me. Thanks for the patch!

Cheers,
Janus



> 2018-05-23  Steven G. Kargl  <kargl@gcc.gnu.org>
>
>         PR fortran/85895
>         * resolve.c (resolve_sync): Resolve expression before checking for
>         an error.
>
> 2018-05-23  Steven G. Kargl  <kargl@gcc.gnu.org>
>
>         PR fortran/85895
>
>         * gfortran.dg/coarray_3.f90: Fix invalid testcase.
>         * gfortran.dg/pr85895.f90: New test.
>
> --
> Steve

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-05-24 20:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-23 23:45 [PATCH] PR fortran/85895 -- Check for valid errmsg entity Steve Kargl
2018-05-24 20:14 ` Janus Weil

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).