Bug 78219

Summary: [F08] specifying the kind of a FORALL index in the header
Product: gcc Reporter: janus
Component: fortranAssignee: Not yet assigned to anyone <unassigned>
Status: NEW ---    
Severity: normal CC: juergen.reuter
Priority: P3 Keywords: rejects-valid
Version: 7.0   
Target Milestone: ---   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed: 2016-11-05 00:00:00
Bug Depends on:    
Bug Blocks: 39627, 44646    

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

end


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

and

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
Confirmed.
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).
Comment 5 Jürgen Reuter 2018-10-19 15:37:16 UTC
It appears that the link to this PR shall replace the link to PR4646 at the Fortran2008 wiki status page: https://gcc.gnu.org/wiki/Fortran2008Status
The PR44646 (feature request) is closed now.
Comment 6 Jürgen Reuter 2018-10-19 15:38:19 UTC
(In reply to Jürgen Reuter from comment #5)
> It appears that the link to this PR shall replace the link to PR4646 at the
> Fortran2008 wiki status page: https://gcc.gnu.org/wiki/Fortran2008Status
> The PR44646 (feature request) is closed now.

Typo: first PR should be also PR44646.