[Ping, Patch, fortran, 64674, v3] [OOP] ICE in ASSOCIATE with class array

Andre Vehreschild vehre@gmx.de
Mon Jun 22 15:16:00 GMT 2015


Hi Paul,

On Mon, 22 Jun 2015 16:04:09 +0200
Paul Richard Thomas <paul.richard.thomas@gmail.com> wrote:

> Hi Andre,
> 
> Some questions: The first and second chunks look a bit awkward in
> parse.c. Do they have to be there in order that primary.c does the
> right thing?

I tried at first to do this rank resolution in primary.c, but that was too
late. parse.c needs to propagate the rank correctly. When I remember correctly,
then doing so later prevents parse.c to correctly recognize the vector (from
the example in the initial description) as such, i.e., the indexing in
vector(2) was not allowed. gfortran assumed vector to be scalar. So, IMHO yes.

> Could the whole lot be transferred to resolve.c or would that make it
> horribly messy?

Again, IMO is it not easily transferable to primary.c or even resolve.c.
Therefore no.

> I couldn't apply the patch right now -
> does it work with variable expressions for the target array indices?

I am not quite sure, what you mean. Something like this:

  associate(pam => im(2:3, 2:3))
    pam = 9
    pam(1,2) = 10
    do c = 1, 2
        pam(2, c) = 0
    end do
  end associate

? I have added that to the testcase and it works. Or do you want the variable
expressions in the target, like this:

  integer :: expect(20)= 23
  integer :: im(4,5) = 23
  integer :: c

  expect(2:3) = 9
  do c = 1, 5
    im = 23
    associate(pam => im(:, c))
      pam(2:3) = 9
    end associate
    if (any (reshape(im, [20]) /= expect)) call abort()
    ! Shift expect
    expect = [expect(17:), expect(:16)]
  end do

Will this do, or did you have something more elaborate in mind? This is also
working and in the testcase now.

Thanks for the review so far.

Regards,
	Andre
-- 
Andre Vehreschild * Email: vehre ad gmx dot de 



More information about the Gcc-patches mailing list