[Bug fortran/19182] Error messages seem to be printed slower
schnetter at aei dot mpg dot de
gcc-bugzilla@gcc.gnu.org
Tue Dec 28 22:31:00 GMT 2004
------- Additional Comments From schnetter at aei dot mpg dot de 2004-12-28 22:31 -------
I didn't try the putc vs. fputc change, but the patch below makes all the
difference:
$ cvs diff -u error.c
Index: error.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/error.c,v
retrieving revision 1.8
diff -u -r1.8 error.c
--- error.c 16 Sep 2004 16:00:41 -0000 1.8
+++ error.c 28 Dec 2004 22:26:52 -0000
@@ -74,6 +74,13 @@
static void
error_char (char c)
{
+ static int bufset = 0;
+ if (! bufset)
+ {
+ setvbuf (stderr, 0, _IOLBF, 0);
+ bufset = 1;
+ }
+
if (buffer_flag)
{
if (use_warning_buffer)
The call to setvbuf switches to line buffering, meaning that stderr is flushed
only after every line and not after every character. I assume that cc1 (as
opposed to f951) switches to line buffered stderr at some time, or else
outputs its error messages in some other way which is equivalent to some
internal buffering. f951 outputs its messages character by character, which
leads to an unnecessary overhead.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19182
More information about the Gcc-bugs
mailing list