c: fix ICE when forming composite type for two structures / unions [PR117548]
[official-gcc.git] / gcc / testsuite / gfortran.dg / array_temporaries_3.f90
blobe3bb560b6abb8b1ec2e579fd4e67b34cf8d8837e
1 ! { dg-do run }
2 ! PR38119 - The scalarizer got the loop size wrong
3 ! for the temporary coming from the call to 'same'.
5 ! Contributed by Mikael Morin <mikael.morin@tele2.fr>
6 ! based on a program by Vivek Rao.
8 module bar
9 implicit none
10 character(len = 2) :: c(1)
11 contains
12 elemental function trim_append (xx,yy) result(xy)
13 character (len = *), intent(in) :: xx,yy
14 character (len = len (xx) + len (yy)) :: xy
15 xy = trim (xx) // trim (yy)
16 end function trim_append
17 function same(xx) result(yy)
18 character (len = *), intent(in) :: xx(:)
19 character (len = len (xx)) :: yy(size (xx))
20 yy = xx
21 end function same
22 subroutine xmain()
23 c = trim_append(["a"],same(["b"])) ! The problem occurred here
24 end subroutine xmain
25 end module bar
26 use bar
27 call xmain
28 if (c(1) .ne. "ab") STOP 1
29 end