gcc/testsuite/gfortran.dg/elemental_dependency_6.f90
raw| 1 | ! { dg-do run } |
| 2 | ! |
| 3 | ! PR fortran/66089 |
| 4 | ! Check that we do create a temporary for C(1) below in the assignment |
| 5 | ! to C. |
| 6 | |
| 7 | type :: t |
| 8 | integer :: c |
| 9 | end type t |
| 10 | |
| 11 | type(t), dimension(5) :: b, c |
| 12 | |
| 13 | b = t(7) |
| 14 | c = t(13) |
| 15 | c = plus(c(1), b) |
| 16 | ! print *, c |
| 17 | if (any(c%c /= 20)) STOP 1 |
| 18 | |
| 19 | contains |
| 20 | |
| 21 | elemental function plus(lhs, rhs) |
| 22 | type(t), intent(in) :: lhs, rhs |
| 23 | type(t) :: plus |
| 24 | plus%c = lhs%c + rhs%c |
| 25 | end function plus |
| 26 | |
| 27 | end |