OK, so here is a new version. I think the discussion has shown that enlaring the buffer makes sense, and that the buffer size for unformatted seems to be too bad.
I've reversed the names of the environment variables according to Behnard's suggestion. So, OK for trunk? Also, what should we do about gcc-9? I have now come to think that we should add the environment variables to set the buffer lengths, but leave the old default (8192). What do you think? Regards Thomas 2019-07-14 Thomas König <tkoe...@gcc.gnu.org> PR libfortran/91030 * gfortran.texi (GFORTRAN_FORMATTED_BUFFER_SIZE): Document (GFORTRAN_UNFORMATTED_BUFFER_SIZE): Likewise. 2019-07-14 Thomas König <tkoe...@gcc.gnu.org> PR libfortran/91030 * io/unix.c (BUFFER_SIZE): Delete. (BUFFER_FORMATTED_SIZE_DEFAULT): New variable. (BUFFER_UNFORMATTED_SIZE_DEFAULT): New variable. (unix_stream): Add buffer_size. (buf_read): Use s->buffer_size instead of BUFFER_SIZE. (buf_write): Likewise. (buf_init): Add argument unformatted. Handle block sizes for unformatted vs. formatted, using defaults if provided. (fd_to_stream): Add argument unformatted in call to buf_init. * libgfortran.h (options_t): Add buffer_size_formatted and buffer_size_unformatted. * runtime/environ.c (variable_table): Add GFORTRAN_UNFORMATTED_BUFFER_SIZE and GFORTRAN_FORMATTED_BUFFER_SIZE.