gcc/testsuite/gfortran.dg/realloc_on_assign_25.f90
raw| 1 | ! { dg-do run } |
| 2 | ! PR 47674 - this would segfault if MALLOC_PERTURB is set. |
| 3 | ! This checks a code path where it is not possible to determine |
| 4 | ! the length of the string at compile time. |
| 5 | ! |
| 6 | program main |
| 7 | implicit none |
| 8 | character(:), allocatable :: a |
| 9 | integer :: m, n |
| 10 | a = 'a' |
| 11 | if (a .ne. 'a') STOP 1 |
| 12 | a = a // 'x' |
| 13 | if (a .ne. 'ax') STOP 2 |
| 14 | if (len (a) .ne. 2) STOP 3 |
| 15 | n = 2 |
| 16 | m = 2 |
| 17 | a = a(m:n) |
| 18 | if (a .ne. 'x') STOP 4 |
| 19 | if (len (a) .ne. 1) STOP 5 |
| 20 | end program main |