public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
* PR 82275: gfortran rejects valid & accepts invalid references to a dimension-remapped type selector
@ 2017-09-21  4:21 Damian Rouson
  0 siblings, 0 replies; only message in thread
From: Damian Rouson @ 2017-09-21  4:21 UTC (permalink / raw)
  To: gfortran; +Cc: Porter, Ian

 
I just submitted the text below in the above referenced bug report.  I did a 
quick search to try to figure out if this relates to existing issues with 
ASSOCIATE, but I don’t find an obvious relationship.  I tried to reproduce this
with just an ASSOCIATE statement without polymorphism and type guarding but
couldn’t reproduce the problem without these language features present.

Damian


$ cat reproducer.f90 
!! Associating a name with a reduced-dimension section of a
!! multidimensional array precludes subsequent use of the name
!! with the appropriately reduced dimensionality and instead
!! requires use of the (invalid) full set of original dimensions.
!! It seems that this only occurs in the presence of type guarding:
  type component
  end type
  type container
    class(component), allocatable :: component_array(:,:)
  end type
  type(container) bag
  type(component) section_copy
  allocate(component::bag%component_array(1,1))
  select type(associate_name=>bag%component_array(1,:))
    type is (component)
      section_copy = associate_name(1)  ! gfortran 5,6,7,8 reject valid
      section_copy = associate_name(1,1)! gfortran 5,6,7,8 accept invalid
  end select
end

$ gfortran reproducer.f90 
reproducer.f90:16:35:

       section_copy = associate_name(1)  ! gfortran 5,6,7,8 reject valid
                                   1
Error: Rank mismatch in array reference at (1) (1/2)
rouson@Sourcery-Linux-VM:~/Desktop/Builds/adhoc/src/gnu/nrc/rank-mismatch$ gfortran --version
GNU Fortran (GCC) 8.0.0 20170912 (experimental)


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

only message in thread, other threads:[~2017-09-21  4:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-21  4:21 PR 82275: gfortran rejects valid & accepts invalid references to a dimension-remapped type selector Damian Rouson

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