http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30162
--- Comment #30 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2012-12-14 23:07:34 UTC --- This seems to do the trick. Index: unix.c =================================================================== --- unix.c (Revision 194507) +++ unix.c (Arbeitskopie) @@ -344,7 +344,15 @@ static gfc_offset raw_tell (unix_stream * s) { - return lseek (s->fd, 0, SEEK_CUR); + gfc_offset x; + x = lseek (s->fd, 0, SEEK_CUR); + + /* Non-seekable files should always be assumed to be at + current position. */ + if (x == -1 && errno == ESPIPE) + x = 0; + + return x; } static gfc_offset