This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch, libfortran] PR36094 Runtime error show_locus not working correctly


Hi,

This simple patch takes care of the case where filename_from_unit returns NULL. If a filename is not yet associated with the given unit when an error occurs, show_locus will show unit number by itself.

The patch also comments out a portion of the encoding_options array so that "utf-8" throws a runtime error.

I will commit as obvious and simple if regression testing passes.

Jerry

2008-04-30 Jerry DeLisle <jvdelisle@gcc.gnu.org>

	PR libfortran/36094
	* runtime/error.c (show_locus): Provide modified error message when
	filename has not yet been associated with a unit number.
	* io/open.c (encoding_opt[]): Comment out "utf-8" option and add TODO.
Index: runtime/error.c
===================================================================
--- runtime/error.c	(revision 134845)
+++ runtime/error.c	(working copy)
@@ -202,6 +202,11 @@ show_locus (st_parameter_common *cmp)
 		   (int) cmp->line, cmp->filename, cmp->unit, filename);
 	  free_mem (filename);
 	}
+      else
+	{
+	  st_printf ("At line %d of file %s (unit = %d)\n",
+		   (int) cmp->line, cmp->filename, cmp->unit);
+	}
       return;
     }
 
Index: io/open.c
===================================================================
--- io/open.c	(revision 134845)
+++ io/open.c	(working copy)
@@ -107,7 +107,7 @@ static const st_option decimal_opt[] =
 
 static const st_option encoding_opt[] =
 {
-  { "utf-8", ENCODING_UTF8},
+  /* TODO { "utf-8", ENCODING_UTF8}, */
   { "default", ENCODING_DEFAULT},
   { NULL, 0}
 };

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]