3 ! Tests the fix for PR85603.
5 ! Contributed by Walt Spector <w6ws@earthlink.net>
6 !_____________________________________________
7 ! Module for a test against a regression that occurred with
8 ! the first patch for this PR.
13 INTEGER,PARAMETER::SH4
=KIND('a')
15 CHARACTER(:,KIND
=SH4
),ALLOCATABLE
::ROR
16 CHARACTER(:,KIND
=SH4
),ALLOCATABLE
::VI8
18 PROCEDURE
,NON_OVERRIDABLE
::SB
=>TPX
21 SUBROUTINE TPX(TP6
,PP4
)
22 CLASS(TOP
),INTENT(INOUT
)::TP6
23 INTEGER,INTENT(IN
)::PP4
24 TP6
%ROR
=TP6
%ROR(:PP4
-1)
25 TP6
%VI8
=TP6
%ROR(:PP4
-1)
28 !_____________________________________________
33 character(:), allocatable
:: strings(:)
36 strings
= [ character(32) :: &
39 maxlen
= maxval (len_trim (strings
))
40 if (maxlen
.ne
. 15) stop 1
42 ! Used to cause an ICE and in the later version of the problem did not reallocate.
43 strings
= strings(:)(:maxlen
)
44 if (any (strings
.ne
. ['short ','somewhat longer' ])) stop 2
45 if (len (strings
) .ne
. maxlen
) stop 3
47 ! Try something a bit more complicated.
48 strings
= strings(:)(2:maxlen
- 5)
49 if (any (strings
.ne
. ['hort ','omewhat l' ])) stop 4
50 if (len (strings
) .ne
. maxlen
- 6) stop 5
52 deallocate (strings
) ! To check for memory leaks
54 ! Test the regression, noted by Dominique d'Humieres is fixed.
55 ! Referenced in https://groups.google.com/forum/#!topic/comp.lang.fortran/nV3TlRlVKBc
65 if (Z
%VI8
.ne
. 'ab') stop 6