* [PATCH] PR fortran/91943 -- More BOZ fallout
@ 2019-09-30 22:23 Steve Kargl
2019-10-11 14:56 ` Janne Blomqvist
0 siblings, 1 reply; 3+ messages in thread
From: Steve Kargl @ 2019-09-30 22:23 UTC (permalink / raw)
To: fortran, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 590 bytes --]
A BOZ cannot be an actual argument in a subroutine or function
reference except those intrinsic function listed in the Fortran
standard. The attach patch checks for invalid BOZ. Built and
tested on x86_64-*-freebsd. OK to commit?
2019-09-30 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/91943
* match.c (gfc_match_call): BOZ cannot be an actual argument in
a subroutine reference.
* resolve.c (resolve_function): BOZ cannot be an actual argument in
a function reference.
2019-09-30 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/91943
gfortran.dg/pr91943.f90
--
Steve
[-- Attachment #2: pr91943.diff --]
[-- Type: text/x-diff, Size: 1961 bytes --]
Index: gcc/fortran/match.c
===================================================================
--- gcc/fortran/match.c (revision 276271)
+++ gcc/fortran/match.c (working copy)
@@ -4984,6 +4984,16 @@ gfc_match_call (void)
goto syntax;
}
+ /* Walk the argument list looking for invalid BOZ. */
+ for (a = arglist; a; a = a->next)
+ if (a->expr && a->expr->ts.type == BT_BOZ)
+ {
+ gfc_error ("A BOZ literal constant at %L cannot appear as an actual "
+ "argument in a subroutine reference", &a->expr->where);
+ goto cleanup;
+ }
+
+
/* If any alternate return labels were found, construct a SELECT
statement that will jump to the right place. */
Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c (revision 276271)
+++ gcc/fortran/resolve.c (working copy)
@@ -3242,6 +3242,21 @@ resolve_function (gfc_expr *expr)
if (expr->expr_type != EXPR_FUNCTION)
return t;
+ /* Walk the argument list looking for invalid BOZ. */
+ if (expr->value.function.esym)
+ {
+ gfc_actual_arglist *a;
+
+ for (a = expr->value.function.actual; a; a = a->next)
+ if (a->expr && a->expr->ts.type == BT_BOZ)
+ {
+ gfc_error ("A BOZ literal constant at %L cannot appear as an "
+ "actual argument in a function reference",
+ &a->expr->where);
+ return false;
+ }
+ }
+
temp = need_full_assumed_size;
need_full_assumed_size = 0;
Index: gcc/testsuite/gfortran.dg/pr91943.f90
===================================================================
--- gcc/testsuite/gfortran.dg/pr91943.f90 (nonexistent)
+++ gcc/testsuite/gfortran.dg/pr91943.f90 (working copy)
@@ -0,0 +1,7 @@
+! { dg-do compile }
+! PR fortran/91943
+! Code contributed by Gerhard Steinmetz
+program p
+ print *, f(b'1001') ! { dg-error "cannot appear as an actual argument" }
+ call sub(b'1001') ! { dg-error "cannot appear as an actual argument" }
+end
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] PR fortran/91943 -- More BOZ fallout
2019-09-30 22:23 [PATCH] PR fortran/91943 -- More BOZ fallout Steve Kargl
@ 2019-10-11 14:56 ` Janne Blomqvist
2019-10-11 15:34 ` Steve Kargl
0 siblings, 1 reply; 3+ messages in thread
From: Janne Blomqvist @ 2019-10-11 14:56 UTC (permalink / raw)
To: Steve Kargl; +Cc: Fortran List, GCC Patches
On Tue, Oct 1, 2019 at 1:23 AM Steve Kargl
<sgk@troutmask.apl.washington.edu> wrote:
>
> A BOZ cannot be an actual argument in a subroutine or function
> reference except those intrinsic function listed in the Fortran
> standard. The attach patch checks for invalid BOZ. Built and
> tested on x86_64-*-freebsd. OK to commit?
>
> 2019-09-30 Steven G. Kargl <kargl@gcc.gnu.org>
>
> PR fortran/91943
> * match.c (gfc_match_call): BOZ cannot be an actual argument in
> a subroutine reference.
> * resolve.c (resolve_function): BOZ cannot be an actual argument in
> a function reference.
>
> 2019-09-30 Steven G. Kargl <kargl@gcc.gnu.org>
>
> PR fortran/91943
> gfortran.dg/pr91943.f90
>
> --
> Steve
Ok, though I believe your other BOZ patch that I just reviewed applies
on top of this one?
--
Janne Blomqvist
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] PR fortran/91943 -- More BOZ fallout
2019-10-11 14:56 ` Janne Blomqvist
@ 2019-10-11 15:34 ` Steve Kargl
0 siblings, 0 replies; 3+ messages in thread
From: Steve Kargl @ 2019-10-11 15:34 UTC (permalink / raw)
To: Janne Blomqvist; +Cc: Fortran List, GCC Patches
On Fri, Oct 11, 2019 at 05:55:45PM +0300, Janne Blomqvist wrote:
> On Tue, Oct 1, 2019 at 1:23 AM Steve Kargl
> <sgk@troutmask.apl.washington.edu> wrote:
> >
> > A BOZ cannot be an actual argument in a subroutine or function
> > reference except those intrinsic function listed in the Fortran
> > standard. The attach patch checks for invalid BOZ. Built and
> > tested on x86_64-*-freebsd. OK to commit?
> >
> > 2019-09-30 Steven G. Kargl <kargl@gcc.gnu.org>
> >
> > PR fortran/91943
> > * match.c (gfc_match_call): BOZ cannot be an actual argument in
> > a subroutine reference.
> > * resolve.c (resolve_function): BOZ cannot be an actual argument in
> > a function reference.
> >
> > 2019-09-30 Steven G. Kargl <kargl@gcc.gnu.org>
> >
> > PR fortran/91943
> > gfortran.dg/pr91943.f90
> >
> > --
> > Steve
>
> Ok, though I believe your other BOZ patch that I just reviewed applies
> on top of this one?
>
Yes. This patch was applied in
r276471 | kargl | 2019-10-02 10:01:30 -0700 (Wed, 02 Oct 2019) | 13 lines
I had a growing stack of patches interfering/interacting with
each other. As I completely changed how BOZ are handled, I
figure that this one could be committed without a review.
--
Steve
20170425 https://www.youtube.com/watch?v=VWUpyCsUKR4
20161221 https://www.youtube.com/watch?v=IbCHE-hONow
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-10-11 15:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-30 22:23 [PATCH] PR fortran/91943 -- More BOZ fallout Steve Kargl
2019-10-11 14:56 ` Janne Blomqvist
2019-10-11 15:34 ` Steve Kargl
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).