[gfortran] PR 19182

Tobias Schlüter tobias.schlueter@physik.uni-muenchen.de
Sat Jan 8 13:07:00 GMT 2005


Andreas Schwab wrote:
> Tobias Schlüter <tobias.schlueter@physik.uni-muenchen.de> writes:
>>Index: error.c
>>===================================================================
>>RCS file: /cvs/gcc/gcc/gcc/fortran/error.c,v
>>retrieving revision 1.9
>>diff -u -p -r1.9 error.c
>>--- error.c     3 Jan 2005 21:43:49 -0000       1.9
>>+++ error.c     8 Jan 2005 00:03:29 -0000
>>@@ -86,7 +86,20 @@ error_char (char c)
>>   else
>>     {
>>       if (c != 0)
>>-       fputc (c, stderr);
>>+       {
>>+         /* We build up complete lines before passing handing things
>>+            over to the library in order ot speed up error printing.  */
>>+         static char line[MAX_ERROR_MESSAGE];
>>+         static int index = 0;
>>+
>>+         line[index++] = c;
> 
> 
> What if index >= MAX_ERROR_MESSAGE?

This is not going to happen because MAX_ERROR_MESSAGE > gfc_terminal_width (),
but if it reassures you, we can add the following right after the declaration
of index:
	  if (index == MAX_ERROR_MESSAGE - 1)
	    {
	      line[index] = '\0';
	      fputs (line, stderr);
	      index = 0;
	    }
or alternatively issue an internal error, because this situation should not arise.

- Tobi



More information about the Gcc-patches mailing list