gcc/testsuite/gfortran.dg/allocate_with_source_20.f03
raw| 1 | ! { dg-do run } |
| 2 | |
| 3 | ! Check that PR72698 is fixed. |
| 4 | ! Contributed by Gerhard Steinmetz |
| 5 | |
| 6 | module m |
| 7 | contains |
| 8 | integer function f() |
| 9 | f = 4 |
| 10 | end |
| 11 | end |
| 12 | program p |
| 13 | use m |
| 14 | character(3), parameter :: c = 'abc' |
| 15 | character(:), allocatable :: z |
| 16 | allocate (z, source=repeat(c(2:1), f())) |
| 17 | if (len(z) /= 0) STOP 1 |
| 18 | if (z /= "") STOP 2 |
| 19 | end |
| 20 | |
| 21 |