aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/dependency_53.f90
blob: a45302fb0a34e4a056cba35f95c2903fe48fc853 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
! { dg-do run }
! PR fortran/66089 - used to ICE and, after that ICE was fixed,
! gave wrong results.
  type :: t
    integer :: c
  end type t

  class(t), dimension(:), allocatable :: b,c

  allocate (b(5), source=t(7))
  allocate(c(5), source=t(13))
  c = plus(c(1), b)
  if (any(c%c /= 20)) stop 1
  c = t(13)
  c = plus(b, c(1))
  if (any(c%c /= 20)) stop 2
contains

  elemental function plus(lhs, rhs)
    class(t), intent(in) :: lhs, rhs
    type(t)             :: plus
    plus%c = lhs%c + rhs%c
  end function plus

end