| 1 |
! { dg-do run } |
| 2 |
! |
| 3 |
! Test the fix for PR77325, which casued an ICE in the gimplifier. The |
| 4 |
! segafults in 'contains_struct_check' were found while diagnosing the PR. |
| 5 |
! |
| 6 |
! Contributed by Gerhard Steinmetz <[email protected]> |
| 7 |
! |
| 8 |
program p |
| 9 |
character(3), parameter :: a(3) = ['abc', 'def', 'ghi'] |
| 10 |
character(1), parameter :: c(3) = ['a', 'b', 'c'] |
| 11 |
character(:), allocatable :: z(:) |
| 12 |
z = c([3,2]) ! Vector subscripts caused an iCE in the gimplifier. |
| 13 |
if (any (z .ne. ['c', 'b'])) stop 1 |
| 14 |
z = c |
| 15 |
if (any (z .ne. ['a', 'b', 'c'])) stop 2 |
| 16 |
z = c(2:1:-1) |
| 17 |
if (any (z .ne. ['b', 'a'])) stop 3 |
| 18 |
z = c(3) |
| 19 |
if (any (z .ne. ['c', 'c'])) stop 4 |
| 20 |
z = a([3,1,2]) |
| 21 |
if (any (z .ne. ['ghi', 'abc', 'def'])) stop 5 |
| 22 |
z = a(1:2)(2:3) ! Substrings caused a segfault in 'contains_struct_check'. |
| 23 |
if (any (z .ne. ['bc', 'ef'])) stop 6 |
| 24 |
z = a([2,3,1])(2:3) ! ditto |
| 25 |
if (any (z .ne. ['ef', 'hi', 'bc'])) stop 7 |
| 26 |
deallocate (z) |
| 27 |
end |