| 1 |
! { dg-do run } |
| 2 |
! PR libgfortran/105473 |
| 3 |
implicit none |
| 4 |
integer n,m,ios |
| 5 |
real r |
| 6 |
real :: x(3) |
| 7 |
complex z |
| 8 |
character(40):: testinput |
| 9 |
n = 999; m = 777; r=1.2345 |
| 10 |
z = cmplx(0.0,0.0) |
| 11 |
|
| 12 |
! Check that semi-colon is not allowed as separator with decimal=point. |
| 13 |
ios=0 |
| 14 |
testinput = '1;17;3.14159' |
| 15 |
read(testinput,*,decimal='point',iostat=ios) n, m, r |
| 16 |
if (ios /= 5010) stop 1 |
| 17 |
|
| 18 |
! Check that semi-colon allowed as a separator with decimal=point. |
| 19 |
ios=0 |
| 20 |
testinput = '1.23435 1243.24 13.24 ;' |
| 21 |
read(testinput, *, iostat=ios) x |
| 22 |
if (ios /= 0) stop 2 |
| 23 |
|
| 24 |
! Check that comma is not allowed as a separator with decimal=comma. |
| 25 |
ios=0 |
| 26 |
testinput = '1,17,3,14159' |
| 27 |
read(testinput,*,decimal='comma',iostat=ios) n, m, r |
| 28 |
if (ios /= 5010) stop 3 |
| 29 |
|
| 30 |
! Check a good read. |
| 31 |
ios=99 |
| 32 |
testinput = '1;17;3,14159' |
| 33 |
read(testinput,*,decimal='comma',iostat=ios) n, m, r |
| 34 |
if (ios /= 0) stop 4 |
| 35 |
|
| 36 |
! Check that comma is not allowed as a separator with decimal=comma. |
| 37 |
ios=99; z = cmplx(0.0,0.0) |
| 38 |
testinput = '1,17, (3,14159, 1,7182)' |
| 39 |
read(testinput,*,decimal='comma', iostat=ios) n, m, z |
| 40 |
if (ios /= 5010) stop 5 |
| 41 |
|
| 42 |
! Check that semi-colon is not allowed as separator with decimal=point. |
| 43 |
ios=99; z = cmplx(0.0,0.0) |
| 44 |
testinput = '1,17; (3.14159; 1.7182)' |
| 45 |
read(testinput,*,decimal='point', iostat=ios) n, m, z |
| 46 |
if (ios /= 5010) stop 6 |
| 47 |
|
| 48 |
! Check a good read. |
| 49 |
ios=99;z = cmplx(0.0,0.0) |
| 50 |
testinput = '1;17; (3,14159; 1,7182)' |
| 51 |
read(testinput,*,decimal='comma', iostat=ios) n, m, z |
| 52 |
if (ios /= 0) stop 7 |
| 53 |
end program |