3 ! Test the fix for PR72709 in which the type of the component 'header' is cast
4 ! as character[1:0], which makes it slightly more difficult than usual to
5 ! obtain the element length. This is one and the same bug as PR70752.
7 ! Contributed by 'zmi' <zmi007@gmail.com>
12 type experimental_data_t
14 character(len
=:), dimension(:), allocatable
:: header
16 end type experimental_data_t
18 character(*), parameter :: str(3) = ["#Generated by X ", &
20 "# Experimental 4 mg/g"]
21 type(experimental_data_t
) :: ex
28 allocate(character(len
=nh_len
) :: ex
% header(ex
% nh
))
30 ex
% header(1) = str(1)
31 ex
% header(2) = str(2)
32 ex
% header(3) = str(3)
34 ! Test that the string length is OK
35 if (len (ex
%header
) .ne
. nh_len
) stop 1
37 ! Test the array indexing
39 if (trim (ex
%header(i
)) .ne
. trim (str(i
))) stop i
+ 1
42 end program read_exp_data