aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/realloc_on_assign_19.f90
blob: c54a35f40dabcc98dcb1acae472b319b796b5c95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
! { dg-do compile }
! { dg-options "-fdump-tree-original" }
! PR 52243 - avoid check for reallocation when doing simple
! assignments with the same variable on both sides.
module  foo
contains
  elemental function ele(a)
    real, intent(in) :: a
    real :: ele
    ele = 1./(2+a)
  end function ele

  subroutine bar(a)
    real, dimension(:), allocatable :: a
    a = a * 2.0
    a = sin(a-0.3)
    a = ele(a)
  end subroutine bar
end module foo
! { dg-final { scan-tree-dump-times "alloc" 0 "original" } }
! { dg-final { cleanup-tree-dump "original" } }