This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch, libfortran] PR36094 Runtime error show_locus not working correctly
- From: Jerry DeLisle <jvdelisle at verizon dot net>
- To: Fortran List <fortran at gcc dot gnu dot org>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 30 Apr 2008 21:57:57 -0700
- Subject: [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}
};