1 ! { dg-do run { target fd_truncate } }
2 ! PR43605 FTELL intrinsic returns incorrect position
3 ! Contributed by Janne Blomqvist, Manfred Schwarb
4 ! and Dominique d'Humieres.
8 character(len=99) :: buffer
9 open(10, form='formatted', position='rewind')
10 write(10, '(a)') '123456'
11 write(10, '(a)') '789'
12 write(10, '(a)') 'CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC'
13 write(10, '(a)') 'DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD'
15 read(10, '(a)') buffer
17 ! Expected: On '\n' systems: 7, on \r\n systems: 8
18 if(i /= 7 .and. i /= 8) then
22 if (trim(buffer) /= "789") then
27 open(10, access="stream")
28 ! Expected: On '\n' systems: 11, on \r\n systems: 13
31 if (ch /= char(10)) call abort
32 if (j /= 11) call abort
36 if (ch /= char(13)) call abort
38 if (ch /= char(10)) call abort
39 if (j /= 13) call abort
41 close(10, status="delete")