------- Comment #4 from fxcoudert at gcc dot gnu dot org  2007-11-21 13:51 
-------
I think this is valid code. The reduced testcase is:

$ cat y.f90
program testCode
  implicit none
  type vec
    real, dimension(1) :: coords
  end type
  integer :: i
  real, dimension(1,1), parameter :: vy = 1.

  i = 1
  call Sub(vec(vy(:,i)))

contains

  subroutine Sub(xin)
    type(vec) :: xin
    intent(in)  xin

    print*, xin
  end subroutine
end program
$ gfortran y.f90
y.f90: In function ‘testcode’:
y.f90:9: internal compiler error: in gfc_trans_call, at
fortran/trans-stmt.c:321


But it also happens with external functions:
$ cat y2.f90
  implicit none
  type vec
    integer, dimension(1) :: coords
  end type
  integer :: i
  integer, dimension(1,1), parameter :: vy = 0

  i = 1
  call shape(vec(vy(:,i)))
end program
$ gfortran y2.f90
y2.f90: In function ‘MAIN__’:
y2.f90:8: internal compiler error: in gfc_trans_call, at
fortran/trans-stmt.c:321


And it's actually a nice area for bugs to creep in:

$ cat y3.f90
  integer, parameter :: vy(1,1) = 0
  type vec
    integer :: coords(1)
  end type
  integer :: i

  i = 1
  print *, shape(vec(vy(:,i)))
end program
$ gfortran y3.f90
y3.f90: In function ‘MAIN__’:
y3.f90:7: internal compiler error: Bad IO basetype (1)



$ cat y4.f90
  implicit none
  type vec
    integer, dimension(1) :: coords
  end type
  integer :: i
  integer, dimension(1,1), parameter :: vy = 0

  i = 1
  print *, shape(vec(vy(:,i)))
end program
$ gfortran y4.f90
y2.f90: In function ‘MAIN__’:
y2.f90:8: internal compiler error: in gfc_typenode_for_spec, at
fortran/trans-types.c:841


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fxcoudert at gcc dot gnu dot
                   |                            |org
           Keywords|ice-on-invalid-code         |ice-on-valid-code
   Last reconfirmed|2007-05-31 11:57:03         |2007-11-21 13:51:56
               date|                            |


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

Reply via email to