| 1 |
! { dg-do run } |
| 2 |
! { dg-options "-O0" } |
| 3 |
! PR fortran/34537 |
| 4 |
! simplify_transfer used to ICE on divide by zero for cases like this, |
| 5 |
! where the mold expression is a non-constant character expression. |
| 6 |
! |
| 7 |
! Testcase contributed by Tobias Burnus <[email protected] > |
| 8 |
! |
| 9 |
character, pointer :: ptr(:) |
| 10 |
character(8) :: a |
| 11 |
allocate(ptr(9)) |
| 12 |
ptr = transfer('Sample#0'//achar(0),ptr) ! Causes ICE |
| 13 |
if (any (ptr .ne. ['S','a','m','p','l','e','#','0',achar(0)])) STOP 1 |
| 14 |
call test(a) |
| 15 |
if (a .ne. 'Sample#2') STOP 2 |
| 16 |
contains |
| 17 |
subroutine test(a) |
| 18 |
character(len=*) :: a |
| 19 |
a = transfer('Sample#2',a) |
| 20 |
end subroutine test |
| 21 |
end |