aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/transfer_class_3.f90
blob: 90082d7ebf0cf71eb7f241f4f57416c12a20e709 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
! { dg-do run }
!
! Test the fix for PR66679.
!
! Contributed by Miha Polajnar  <polajnar.miha@gmail.com>
!
program main
  implicit none
  class(*), allocatable :: vec(:)
  integer :: var, ans(2)
  allocate(vec(2),source=[1_4, 2_4])

! This worked correctly.
  if (any (transfer(vec,[var],2) .ne. [1_4, 2_4])) stop 1

! This caused an ICE.
  if (any ([transfer(vec(1),[var]), transfer(vec(2),[var])] .ne. [1_4, 2_4])) stop 2
end program main