public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/78219] [F08] specifying the kind of a FORALL index in the header
[not found] <bug-78219-4@http.gcc.gnu.org/bugzilla/>
@ 2021-07-21 0:17 ` kargl at gcc dot gnu.org
2021-07-21 22:09 ` kargl at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 6+ messages in thread
From: kargl at gcc dot gnu.org @ 2021-07-21 0:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78219
kargl at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kargl at gcc dot gnu.org
--- Comment #7 from kargl at gcc dot gnu.org ---
diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
index d148de3e3b5..d7668f6a928 100644
--- a/gcc/fortran/match.c
+++ b/gcc/fortran/match.c
@@ -2350,6 +2350,34 @@ match_forall_iterator (gfc_forall_iterator **result)
gfc_forall_iterator *iter;
locus where;
match m;
+ gfc_typespec ts;
+ bool seen_ts;
+
+ /* In Fortran 2018, one can do "forall (integer :: i = 1:20)".
+ Try to match an optional "type-spec ::" */
+ seen_ts = false;
+ gfc_clear_ts (&ts);
+ m = gfc_match_type_spec (&ts);
+ if (m == MATCH_YES)
+ {
+ seen_ts = (gfc_match (" ::") == MATCH_YES);
+
+ if (seen_ts)
+ {
+ if (!gfc_notify_std (GFC_STD_F2018, "FORALL includes a "
+ "type specification at %C"))
+ return MATCH_ERROR;
+
+ if (ts.type != BT_INTEGER)
+ {
+ gfc_error ("Type-spec at %L shall be INTEGER",
+ &gfc_current_locus);
+ return MATCH_ERROR;
+ }
+ }
+ }
+ else if (m == MATCH_ERROR)
+ return m;
where = gfc_current_locus;
iter = XCNEW (gfc_forall_iterator);
@@ -2358,6 +2386,9 @@ match_forall_iterator (gfc_forall_iterator **result)
if (m != MATCH_YES)
goto cleanup;
+ if (seen_ts)
+ iter->var->ts = ts;
+
if (gfc_match_char ('=') != MATCH_YES
|| iter->var->expr_type != EXPR_VARIABLE)
{
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/78219] [F08] specifying the kind of a FORALL index in the header
[not found] <bug-78219-4@http.gcc.gnu.org/bugzilla/>
2021-07-21 0:17 ` [Bug fortran/78219] [F08] specifying the kind of a FORALL index in the header kargl at gcc dot gnu.org
@ 2021-07-21 22:09 ` kargl at gcc dot gnu.org
2021-09-21 20:01 ` anlauf at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 6+ messages in thread
From: kargl at gcc dot gnu.org @ 2021-07-21 22:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78219
--- Comment #8 from kargl at gcc dot gnu.org ---
(In reply to kargl from comment #7)
> diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
> index d148de3e3b5..d7668f6a928 100644
> --- a/gcc/fortran/match.c
> +++ b/gcc/fortran/match.c
> @@ -2350,6 +2350,34 @@ match_forall_iterator (gfc_forall_iterator **result)
> gfc_forall_iterator *iter;
> locus where;
> match m;
> + gfc_typespec ts;
> + bool seen_ts;
> +
> + /* In Fortran 2018, one can do "forall (integer :: i = 1:20)".
s/2018/2008
> + Try to match an optional "type-spec ::" */
> + seen_ts = false;
> + gfc_clear_ts (&ts);
> + m = gfc_match_type_spec (&ts);
> + if (m == MATCH_YES)
> + {
> + seen_ts = (gfc_match (" ::") == MATCH_YES);
> +
> + if (seen_ts)
> + {
> + if (!gfc_notify_std (GFC_STD_F2018, "FORALL includes a "
s/2018/2008
> + "type specification at %C"))
> + return MATCH_ERROR;
> +
> + if (ts.type != BT_INTEGER)
> + {
> + gfc_error ("Type-spec at %L shall be INTEGER",
> + &gfc_current_locus);
> + return MATCH_ERROR;
> + }
> + }
> + }
> + else if (m == MATCH_ERROR)
> + return m;
>
> where = gfc_current_locus;
> iter = XCNEW (gfc_forall_iterator);
> @@ -2358,6 +2386,9 @@ match_forall_iterator (gfc_forall_iterator **result)
> if (m != MATCH_YES)
> goto cleanup;
>
> + if (seen_ts)
> + iter->var->ts = ts;
> +
> if (gfc_match_char ('=') != MATCH_YES
> || iter->var->expr_type != EXPR_VARIABLE)
> {
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/78219] [F08] specifying the kind of a FORALL index in the header
[not found] <bug-78219-4@http.gcc.gnu.org/bugzilla/>
2021-07-21 0:17 ` [Bug fortran/78219] [F08] specifying the kind of a FORALL index in the header kargl at gcc dot gnu.org
2021-07-21 22:09 ` kargl at gcc dot gnu.org
@ 2021-09-21 20:01 ` anlauf at gcc dot gnu.org
2021-09-21 20:05 ` anlauf at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 6+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-09-21 20:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78219
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |anlauf at gcc dot gnu.org
--- Comment #9 from anlauf at gcc dot gnu.org ---
(In reply to kargl from comment #7)
> diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
The patch unfortunately seems incomplete. It fails when using IMPLICIT NONE
or -fimplicit-none with:
pr78219.f90:3:30:
3 | forall (integer(kind=4) :: i = 1:10)
| 1
Error: Symbol 'i' at (1) has no IMPLICIT type
and similarly for pr102371.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/78219] [F08] specifying the kind of a FORALL index in the header
[not found] <bug-78219-4@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2021-09-21 20:01 ` anlauf at gcc dot gnu.org
@ 2021-09-21 20:05 ` anlauf at gcc dot gnu.org
2021-11-01 21:40 ` kargl at gcc dot gnu.org
2024-04-04 19:57 ` longb at cray dot com
5 siblings, 0 replies; 6+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-09-21 20:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78219
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |longb at cray dot com
--- Comment #10 from anlauf at gcc dot gnu.org ---
*** Bug 102371 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/78219] [F08] specifying the kind of a FORALL index in the header
[not found] <bug-78219-4@http.gcc.gnu.org/bugzilla/>
` (3 preceding siblings ...)
2021-09-21 20:05 ` anlauf at gcc dot gnu.org
@ 2021-11-01 21:40 ` kargl at gcc dot gnu.org
2024-04-04 19:57 ` longb at cray dot com
5 siblings, 0 replies; 6+ messages in thread
From: kargl at gcc dot gnu.org @ 2021-11-01 21:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78219
--- Comment #11 from kargl at gcc dot gnu.org ---
(In reply to anlauf from comment #9)
> (In reply to kargl from comment #7)
> > diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
>
> The patch unfortunately seems incomplete. It fails when using IMPLICIT NONE
> or -fimplicit-none with:
>
> pr78219.f90:3:30:
>
> 3 | forall (integer(kind=4) :: i = 1:10)
> | 1
> Error: Symbol 'i' at (1) has no IMPLICIT type
>
> and similarly for pr102371.
https://gcc.gnu.org/pipermail/gcc-bugs/2021-September/757723.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/78219] [F08] specifying the kind of a FORALL index in the header
[not found] <bug-78219-4@http.gcc.gnu.org/bugzilla/>
` (4 preceding siblings ...)
2021-11-01 21:40 ` kargl at gcc dot gnu.org
@ 2024-04-04 19:57 ` longb at cray dot com
5 siblings, 0 replies; 6+ messages in thread
From: longb at cray dot com @ 2024-04-04 19:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78219
--- Comment #12 from Bill Long <longb at cray dot com> ---
Has this been fixed in a more recent version of gfortran?
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-04-04 19:57 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-78219-4@http.gcc.gnu.org/bugzilla/>
2021-07-21 0:17 ` [Bug fortran/78219] [F08] specifying the kind of a FORALL index in the header kargl at gcc dot gnu.org
2021-07-21 22:09 ` kargl at gcc dot gnu.org
2021-09-21 20:01 ` anlauf at gcc dot gnu.org
2021-09-21 20:05 ` anlauf at gcc dot gnu.org
2021-11-01 21:40 ` kargl at gcc dot gnu.org
2024-04-04 19:57 ` longb at cray dot com
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).