Re: [Patch, fortran] [00/14] PR fortran/50420 Support coarray subreferences

2011-10-18 Thread Mikael Morin
On Sunday 09 October 2011 18:25:25 Tobias Burnus wrote:
 On 07.10.2011 16:38, Mikael Morin wrote:
  The full patchset has passed the fortran testsuite successfully.
  OK for trunk?
 
 OK for the whole patch set. Thanks for finding and fixing the issue!
 
Committed as follows.
I committed 8 and 9 together because I was fearing breakage.

patch  revision
===
1  180140
2  180141
3  180142
4  180143
5  180144
6  180145
7  180146
8,9180147
10 180148
11 180149
12 180150
13 180151
14 180152
tests  180153

Mikael


Re: [Patch, fortran] [00/14] PR fortran/50420 Support coarray subreferences

2011-10-09 Thread Tobias Burnus

On 07.10.2011 16:38, Mikael Morin wrote:

The full patchset has passed the fortran testsuite successfully.
OK for trunk?


OK for the whole patch set. Thanks for finding and fixing the issue!

Tobias


Patches layout

  01..04/14: Add support for non-full arrays in descriptor initialization code.

  05..09/14: Make walk_coarray initialize the scalarizer structs properly to
 accept expression with subreferences.

  10..11/14: Fix corank checking

  12/14: Accept coarray subreferences in simplify_cobound

  13/14: Fix gfc_build_array_type

  14/14: Fix gfc_build_array_ref




[Patch, fortran] [00/14] PR fortran/50420 Support coarray subreferences

2011-10-07 Thread Mikael Morin
Hello, 

the following patches propose to fix bug fortran/50420:
gfortran has been rejecting coarrays as argument to the coarray intrinsics 
({l,u}cobound, image_index) if they had a subreference.
The standard, however, has:
   A subobject of a coarray is a coarray if it does not have any cosubscripts,
   vector subscripts, allocatable component selection, or pointer component
   selection.

The recent scalarizer patchset at 
http://gcc.gnu.org/ml/fortran/2011-09/msg00056.html
makes thing worse by changing a rejects-valid bug into a ice-on-valid bug.

These patches make the necessary change to accept coarray subreferences

The full patchset has passed the fortran testsuite successfully.
OK for trunk?



Patches layout

 01..04/14: Add support for non-full arrays in descriptor initialization code.

 05..09/14: Make walk_coarray initialize the scalarizer structs properly to
accept expression with subreferences.

 10..11/14: Fix corank checking

 12/14: Accept coarray subreferences in simplify_cobound

 13/14: Fix gfc_build_array_type

 14/14: Fix gfc_build_array_ref
2011-10-06  Mikael Morin  mikael.mo...@sfr.fr

PR fortran/50420
* gfortran.dg/coarray_subobject_1.f90: New test.
* gfortran.dg/coarray/subobject_1.f90: New test.
! { dg-do compile }
! { dg-options -fcoarray=single }
!
! PR fortran/50420
! Coarray subobjects were not accepted as valid coarrays
! They should still be rejected if one of the component reference is allocatable
! or pointer

type t
  integer :: i
end type t
type t2
  type(t), allocatable :: a
  type(t), pointer :: c
end type t2
type(t2) :: b[5:*]
allocate(b%a)
allocate(b%c)
b%a%i = 7
b%c%i = 13
if (b%a%i /= 7) call abort
if (any (lcobound(b%a) /= (/ 5 /))) call abort ! { dg-error 
Expected coarray variable }
if (ucobound(b%a, dim=1) /= this_image() + 4) call abort   ! { dg-error 
Expected coarray variable }
if (any (lcobound(b%a%i) /= (/ 5 /))) call abort   ! { dg-error 
Expected coarray variable }
if (ucobound(b%a%i, dim=1) /= this_image() + 4) call abort ! { dg-error 
Expected coarray variable }
if (b%c%i /= 13) call abort
if (any (lcobound(b%c) /= (/ 5 /))) call abort ! { dg-error 
Expected coarray variable }
if (ucobound(b%c, dim=1) /= this_image() + 4) call abort   ! { dg-error 
Expected coarray variable }
if (any (lcobound(b%c%i) /= (/ 5 /))) call abort   ! { dg-error 
Expected coarray variable }
if (ucobound(b%c%i, dim=1) /= this_image() + 4) call abort ! { dg-error 
Expected coarray variable }
end
! { dg-do run }
!
! PR fortran/50420
! Coarray subobjects were not accepted as valid coarrays

  integer  :: i
  integer, parameter :: la = 4, lb = 5, lc = 8
  integer, parameter :: init(la) = -4 + (/ (i, i=1,la) /)
  
  type t
integer :: i
  end type t
  type t2
type(t), allocatable :: a[:]
  end type t2
  type t3
type(t), allocatable :: a(:)[:]
  end type t3

  type(t2) :: b
  type(t3) :: c

  allocate(b%a[lb:*])
  b%a%i = 7
  if (b%a%i /= 7) call abort
  if (any (lcobound(b%a) /= (/ lb /))) call abort
  if (ucobound(b%a, dim=1) /= this_image() + lb - 1) call abort
  if (any (lcobound(b%a%i) /= (/ lb /))) call abort
  if (ucobound(b%a%i, dim=1) /= this_image() + lb - 1) call abort
  allocate(c%a(la)[lc:*])
  c%a%i = init
  if (any(c%a%i /= init)) call abort
  if (any (lcobound(c%a) /= (/ lc /))) call abort
  if (ucobound(c%a, dim=1) /= this_image() + lc - 1) call abort
  if (any (lcobound(c%a%i) /= (/ lc /))) call abort
  if (ucobound(c%a%i, dim=1) /= this_image() + lc - 1) call abort
  if (c%a(2)%i /= init(2)) call abort
  if (any (lcobound(c%a(2)) /= (/ lc /))) call abort
  if (ucobound(c%a(2), dim=1) /= this_image() + lc - 1) call abort
  if (any (lcobound(c%a(2)%i) /= (/ lc /))) call abort
  if (ucobound(c%a(2)%i, dim=1) /= this_image() + lc - 1) call abort
  deallocate(b%a, c%a)
end