File: deferred_character_22.f90

package info (click to toggle)
gcc-arm-none-eabi 15%3A14.2.rel1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,099,328 kB
  • sloc: cpp: 3,627,108; ansic: 2,571,498; ada: 834,230; f90: 235,082; makefile: 79,231; asm: 74,984; xml: 51,692; exp: 39,736; sh: 33,298; objc: 15,629; python: 15,069; fortran: 14,429; pascal: 7,003; awk: 5,070; perl: 3,106; ml: 285; lisp: 253; lex: 204; haskell: 135
file content (27 lines) | stat: -rw-r--r-- 975 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
! { dg-do run }
!
! Test the fix for PR77325, which casued an ICE in the gimplifier. The
! segafults in 'contains_struct_check' were found while diagnosing the PR.
!
! Contributed by Gerhard Steinmetz  <gerhard.steinmetz.fortran@t-online.de>
!
program p
   character(3), parameter :: a(3) = ['abc', 'def', 'ghi']
   character(1), parameter :: c(3) = ['a', 'b', 'c']
   character(:), allocatable :: z(:)
   z = c([3,2])          ! Vector subscripts caused an iCE in the gimplifier.
   if (any (z .ne. ['c', 'b'])) stop 1
   z = c
   if (any (z .ne. ['a', 'b', 'c'])) stop 2
   z = c(2:1:-1)
   if (any (z .ne. ['b', 'a'])) stop 3
   z = c(3)
   if (any (z .ne. ['c', 'c'])) stop 4
   z = a([3,1,2])
   if (any (z .ne. ['ghi', 'abc', 'def'])) stop 5
   z = a(1:2)(2:3)       ! Substrings caused a segfault in 'contains_struct_check'.
   if (any (z .ne. ['bc', 'ef'])) stop 6
   z = a([2,3,1])(2:3)   ! ditto
   if (any (z .ne. ['ef', 'hi', 'bc'])) stop 7
   deallocate (z)
end