| 1 | ! Whole-array assignment: scalar broadcast and array copy. |
| 2 | ! |
| 3 | ! CHECK: 42 |
| 4 | ! CHECK: 42 |
| 5 | ! CHECK: 42 |
| 6 | ! CHECK: 42 |
| 7 | ! CHECK: 42 |
| 8 | program test_array_assign |
| 9 | implicit none |
| 10 | integer, allocatable :: a(:), b(:) |
| 11 | |
| 12 | allocate(a(5)) |
| 13 | a = 42 |
| 14 | |
| 15 | print *, a(1) |
| 16 | print *, a(3) |
| 17 | print *, a(5) |
| 18 | |
| 19 | allocate(b(5)) |
| 20 | b = a |
| 21 | a(1) = 99 |
| 22 | print *, b(1) |
| 23 | print *, b(5) |
| 24 | |
| 25 | deallocate(a) |
| 26 | deallocate(b) |
| 27 | end program |
| 28 |