| 1 |
! { dg-do compile } |
| 2 |
! { dg-additional-options "-Wno-analyzer-too-complex" } |
| 3 |
|
| 4 |
! Copy of gfortran.dg/deferred_character_25.f90 |
| 5 |
! as a regression test for ICE with -fanalyzer (PR analyzer/93774) |
| 6 |
|
| 7 |
PROGRAM TEST |
| 8 |
IMPLICIT NONE |
| 9 |
INTEGER, PARAMETER :: I = 3 |
| 10 |
character (len = i), parameter :: str(5) = ['abc','cde','fgh','ijk','lmn'] |
| 11 |
|
| 12 |
TYPE T |
| 13 |
CHARACTER(LEN=:), ALLOCATABLE :: C(:) |
| 14 |
END TYPE T |
| 15 |
TYPE(T), TARGET :: S |
| 16 |
CHARACTER (LEN=I), POINTER :: P(:) |
| 17 |
|
| 18 |
ALLOCATE ( CHARACTER(LEN=I) :: S%C(5) ) |
| 19 |
s%c = str |
| 20 |
|
| 21 |
! This PR uncovered several problems associated with determining the |
| 22 |
! element length and indexing. Test fairly thoroughly! |
| 23 |
if (SIZE(S%C, 1) .ne. 5) stop 1 |
| 24 |
if (LEN(S%C) .ne. 3) stop 2 |
| 25 |
if (any (s%c .ne. str)) stop 3 |
| 26 |
if (s%c(3) .ne. str(3)) stop 4 |
| 27 |
P => S%C |
| 28 |
if (SIZE(p, 1) .ne. 5) stop 5 |
| 29 |
if (LEN(p) .ne. 3) stop 6 |
| 30 |
if (any (p .ne. str)) stop 7 |
| 31 |
if (p(5) .ne. str(5)) stop 8 |
| 32 |
END PROGRAM TEST |