AArch64: correct constraint on Upl early clobber alternatives
[official-gcc.git] / gcc / testsuite / gfortran.dg / func_assign_2.f90
bloba56b86b99c0b09025a48b0243367bcb09bcbcbbe
1 ! { dg-do run }
2 ! Test the fix for PR40551 in which the assignment
3 ! was not dealing correctly with non-contiguous lhs
4 ! references; eg. a(1,:)
6 ! Reported by by Maciej Zwierzycki
7 ! at http://gcc.gnu.org/ml/fortran/2009-06/msg00254.html
8 ! and by Tobias Burnus <burnus@gcc.gnu.org> on Bugzilla
10 integer :: a(2,2)
11 a = -42
12 a(1,:) = func()
13 if (any (reshape (a, [4]) /= [1, -42, 2, -42])) STOP 1
14 a = -42
15 a(2,:) = func()
16 if (any (reshape (a, [4]) /= [-42, 1, -42, 2])) STOP 2
17 a = -42
18 a(:,1) = func()
19 if (any (reshape (a, [4]) /= [1, 2, -42, -42])) STOP 3
20 a = -42
21 a(:,2) = func()
22 if (any (reshape (a, [4]) /= [-42, -42, 1, 2])) STOP 4
23 contains
24 function func()
25 integer :: func(2)
26 call sub(func)
27 end function func
28 subroutine sub(a)
29 integer :: a(2)
30 a = [1,2]
31 end subroutine
32 end