aboutsummaryrefslogtreecommitdiff
path: root/libgfortran/runtime/error.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgfortran/runtime/error.c')
-rw-r--r--libgfortran/runtime/error.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/libgfortran/runtime/error.c b/libgfortran/runtime/error.c
index bd3c306..959a44b 100644
--- a/libgfortran/runtime/error.c
+++ b/libgfortran/runtime/error.c
@@ -248,8 +248,22 @@ st_sprintf (char *buffer, const char *format, ...)
void
show_locus (st_parameter_common *cmp)
{
+ static char *filename;
+
if (!options.locus || cmp == NULL || cmp->filename == NULL)
return;
+
+ if (cmp->unit > 0)
+ {
+ filename = filename_from_unit (cmp->unit);
+ if (filename != NULL)
+ {
+ st_printf ("At line %d of file %s (unit = %d, file = '%s')\n",
+ (int) cmp->line, cmp->filename, cmp->unit, filename);
+ free_mem (filename);
+ }
+ return;
+ }
st_printf ("At line %d of file %s\n", (int) cmp->line, cmp->filename);
}