| 1 |
! { dg-do run } |
| 2 |
! PR37077 Implement Internal Unit I/O for character KIND=4 |
| 3 |
! Test case prepared by Jerry DeLisle <[email protected]> |
| 4 |
program char4_iunit_2 |
| 5 |
implicit none |
| 6 |
integer, parameter :: k = 4 |
| 7 |
character(kind=4,len=80) :: widestring, str_char4 |
| 8 |
character(kind=1,len=80) :: skinnystring |
| 9 |
integer :: i,j |
| 10 |
real :: x |
| 11 |
character(9) :: str_default |
| 12 |
|
| 13 |
widestring = k_"12345 2.54360 hijklmnop qwertyuiopasdfg" |
| 14 |
skinnystring = "12345 2.54360 hijklmnop qwertyuiopasdfg" |
| 15 |
i = 77777 |
| 16 |
x = 0.0 |
| 17 |
str_default = "xxxxxxxxx" |
| 18 |
str_char4 = k_"xyzzy" |
| 19 |
read(widestring,'(i5,1x,f7.5,1x,a9,1x,a15)') i, x, str_default, str_char4 |
| 20 |
if (i /= 12345 .or. (x - 2.5436001) > epsilon(x) .or. & |
| 21 |
str_default /= "hijklmnop" .or. str_char4 /= k_"qwertyuiopasdfg")& |
| 22 |
STOP 1 |
| 23 |
i = 77777 |
| 24 |
x = 0.0 |
| 25 |
str_default = "xxxxxxxxx" |
| 26 |
str_char4 = k_"xyzzy" |
| 27 |
read(widestring,'(2x,i4,tl3,1x,f7.5,1x,a9,1x,a15)')i, x, str_default,& |
| 28 |
str_char4 |
| 29 |
if (i /= 345 .or. (x - 52.542999) > epsilon(x) .or. & |
| 30 |
str_default /= "0 hijklmn" .or. str_char4 /= k_"p qwertyuiopasd")& |
| 31 |
STOP 2 |
| 32 |
read(skinnystring,'(2x,i4,tl3,1x,f7.5,1x,a9,1x,a15)')i, x, str_default,& |
| 33 |
str_char4 |
| 34 |
if (i /= 345 .or. (x - 52.542999) > epsilon(x) .or. & |
| 35 |
str_default /= "0 hijklmn" .or. str_char4 /= k_"p qwertyuiopasd")& |
| 36 |
STOP 3 |
| 37 |
write(widestring,'(2x,i4,tl3,1x,f10.5,1x,a9,1x,a15)')i, x, str_default,& |
| 38 |
trim(str_char4) |
| 39 |
if (widestring .ne. k_" 3 52.54300 0 hijklmn p qwertyuiopasd") STOP 4 |
| 40 |
write(skinnystring,'(2x,i4,tl3,1x,f10.5,1x,a9,1x,a15)')i, x, str_default,& |
| 41 |
trim(str_char4) |
| 42 |
if (skinnystring .ne. " 3 52.54300 0 hijklmn p qwertyuiopasd") STOP 5 |
| 43 |
write(widestring,*)"test",i, x, str_default,& |
| 44 |
trim(str_char4) |
| 45 |
if (widestring .ne. & |
| 46 |
k_" test 345 52.5429993 0 hijklmnp qwertyuiopasd") STOP 6 |
| 47 |
end program char4_iunit_2 |