public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/44672]  New: [F2008] ALLOCATE with SOURCE and no array-spec
@ 2010-06-25 20:00 burnus at gcc dot gnu dot org
  0 siblings, 0 replies; only message in thread
From: burnus at gcc dot gnu dot org @ 2010-06-25 20:00 UTC (permalink / raw)
  To: gcc-bugs

Follow up to PR 43388.

Currently,
   ALLOCATE (var(allocate-shape-spec-list), SOURCE=source-expr)
works but
   ALLOCATE (var(allocate-shape-spec-list), SOURCE=array-source-expr)
does not; in the latter case the array shape should be taken from the SOURCE --
this is a new Fortran 2008 feature.

Currently, it is rejected with:

allocate(a, source=c) ! FAILS but is valid F2008
         1
Error: Array specification required in ALLOCATE statement at (1)


Test case:

type t
end type t
type(t) :: a(:), b, c(:)
allocatable :: a,b,c
allocate(b,c(5))
allocate(a(5), source=b) ! OK 
allocate(a, source=c) ! FAILS but is valid F2008
end


>From the standards. Fortran 2003 has:

C628 (R628) An allocate-shape-spec-list shall appear if
            and only if the allocate-object is an array.

C632 (R623) The source-expr shall be a scalar or have the same
            rank as allocate-object.


While Fortran 2008 has:

C633 (R631) If allocate-object is an array either allocate-shape-spec-list
            shall appear or source-expr shall appear and have the same rank
            as allocate-object. If allocate-object is scalar,
            allocate-shape-spec-list shall not appear.

C638 (R626) Each allocate-object shall be type compatible (4.3.1.3) with
            source-expr. If SOURCE= appears, source-expr shall be a scalar
            or have the same rank as each allocate-object.


-- 
           Summary: [F2008] ALLOCATE with SOURCE and no array-spec
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44672


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-06-25 20:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-25 20:00 [Bug fortran/44672] New: [F2008] ALLOCATE with SOURCE and no array-spec burnus at gcc dot gnu dot org

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