------- Comment #9 from dannysmith at users dot sourceforge dot net 2006-09-12 23:36 -------
The problem is that although all 'regular' files are opened as O_BINARY, preconnected files stderr and stdout are already opened as default O_TEXT. The simplest fix is just to force the mode of these preconnected files to O_BINARY at initialisation, as below. This needs more testing before I submit a formal patch, but it certainly fixes a lot of gfortran mingw32 testsuite cases where stdout results are scanned. The alternative would be to change each #ifdef (HAVE_CRLF) to if (HAVE_CRLF) && is_regular_file(fd) Index: io/unix.c =================================================================== *** io/unix.c (revision 116838) --- io/unix.c (working copy) *************** input_stream (void) *** 1289,1294 **** --- 1289,1297 ---- stream * output_stream (void) { + #if defined(HAVE_CRLF) && defined(O_BINARY) + setmode (fileno (stdout), O_BINARY); + #endif return fd_to_stream (STDOUT_FILENO, PROT_WRITE); } *************** output_stream (void) *** 1299,1304 **** --- 1302,1310 ---- stream * error_stream (void) { + #if defined(HAVE_CRLF) && defined(O_BINARY) + setmode (fileno (stderr), O_BINARY); + #endif return fd_to_stream (STDERR_FILENO, PROT_WRITE); } -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27964