Bug 78219 - [F08] specifying the kind of a FORALL index in the header
Summary: [F08] specifying the kind of a FORALL index in the header
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 7.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Keywords: rejects-valid
Depends on:
Blocks: F2008 44646
  Show dependency treegraph
Reported: 2016-11-05 11:58 UTC by janus
Modified: 2018-04-18 19:59 UTC (History)
2 users (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed: 2016-11-05 00:00:00


Note You need to log in before you can comment on or make changes to this bug.
Description janus 2016-11-05 11:58:33 UTC
The following is supposed to be valid Fortran 2008 code, IIUC:

program forall_2008

  forall (integer(kind=4) :: i = 1:10)
  end forall


However, gfortran currently throws a "Syntax error in FORALL statement".
Comment 1 janus 2016-11-05 12:12:13 UTC
My version of the Fortran 2008 standard has:

R752 forall-header is ( [ type-spec :: ] forall-triplet-spec-list [, scalar-mask-expr ] )


C735 (R752) type-spec shall specify type integer.

Actually it seems that not only specifying a kind is new, but specifying the type at all (which is restricted to integer anyway).

gfortran also rejects this simpler version (which only specifies the type, but no explicit kind):

  forall (integer :: i = 1:10)
Comment 2 Dominique d'Humieres 2016-11-05 14:00:52 UTC
Comment 3 kargl 2016-11-05 15:26:51 UTC
See array.c(gfc_match_array_constructor) for code to match
a type spec in an array constructor.  Looks like a copy and
paste with an additional check for INTEGER to 
match.c:match_forall_header mamy fix this bug.
Comment 4 janus 2018-04-18 19:59:01 UTC
Note: These things (R752 and C735) also apply to DO CONCURRENT (PR 44646).