gcc/testsuite/gfortran.dg/coarray/pr125021.f90
raw| 1 | !{ dg-do run } |
| 2 | |
| 3 | ! Contributed by Neil Carlson <[email protected]> |
| 4 | ! Test for PR fortran/125021 |
| 5 | |
| 6 | type box |
| 7 | integer, allocatable :: data(:) |
| 8 | end type |
| 9 | type(box), allocatable :: buffer[:] |
| 10 | |
| 11 | integer :: i, n |
| 12 | |
| 13 | allocate(buffer[*]) |
| 14 | allocate(buffer%data(1), source=this_image()) |
| 15 | sync all |
| 16 | |
| 17 | i = 1 + modulo(this_image(), num_images()) |
| 18 | n = buffer[i]%data(1) |
| 19 | if (n /= i ) error stop |
| 20 | end |
| 21 |