summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/transfer_resolve_1.f90
blob: 8d326a186a4401b66459178323d95d4edb08d368 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
! { dg-do run }
! PR40847 - an error in gfc_resolve_transfer caused the character length
! of 'mold' to be set incorrectly.
!
! Contributed by Joost VandeVondele <jv244@cam.ac.uk>
!
program test_elemental

if (any (transfer_size((/0.,0./),(/'a','b'/)) .ne. [4 ,4])) call abort

contains

   elemental function transfer_size (source, mold)
     real, intent(in)         :: source
     character(*), intent(in) :: mold
     integer                  :: transfer_size
     transfer_size = SIZE(TRANSFER(source, (/mold/)))
     return
   end function transfer_size

end program test_elemental