| 1 |
! { dg-do compile } |
| 2 |
! { dg-additional-options "-fcheck=bounds -fdump-tree-optimized" } |
| 3 |
! |
| 4 |
! PR fortran/53357 - bounds-check for character type-spec in ALLOCATE |
| 5 |
|
| 6 |
program pr53357 |
| 7 |
implicit none |
| 8 |
integer :: i, j |
| 9 |
i = 3 |
| 10 |
j = 5 |
| 11 |
block |
| 12 |
character(len=i), allocatable :: str1 |
| 13 |
character(len=j), allocatable :: str2 |
| 14 |
allocate (character(len=3) :: & |
| 15 |
str1, & ! runtime check optimized away |
| 16 |
str2 ) ! runtime check kept |
| 17 |
end block |
| 18 |
end |
| 19 |
|
| 20 |
! { dg-final { scan-tree-dump-times "_gfortran_runtime_error_at" 1 "optimized" } } |
| 21 |
! { dg-final { scan-tree-dump-times "At line 16 of file" 1 "optimized" } } |