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]

[gfortran,patch] Handle included fines


Patch below fixes PR 33528, which is about gfortran emitting wrong debug info (wrong locations, actually) when configured with --enable- mapped-location. It's simply that we didn't record exiting included files, which is fixed by the added call to linemap_add(). It took me some time to find out, because the debugging code in gfc_new_file() didn't use LOCATION_FILE, so I changed that also.

Bootstrapped and regtested on x86_64-linux, OK for mainline?

FX




:ADDPATCH fortran:


2007-09-22 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>

	PR fortran/33528
	* scanner.c (preprocessor_line): Call linemap_add when exiting
	a file.
	(gfc_new_file): Adjust debug code for USE_MAPPED_LOCATION.


Index: scanner.c
===================================================================
--- scanner.c (revision 128671)
+++ scanner.c (working copy)
@@ -1341,7 +1341,12 @@ preprocessor_line (char *c)
gfc_free (filename);
return;
}
+
current_file = current_file->up;
+#ifdef USE_MAPPED_LOCATION
+ linemap_add (line_table, LC_RENAME, false, current_file- >filename,
+ current_file->line);
+#endif
}
/* The name of the file can be a temporary file produced by
@@ -1620,10 +1625,12 @@ gfc_new_file (void)
#if 0 /* Debugging aid. */
for (; line_head; line_head = line_head->next)
- gfc_status ("%s:%3d %s\n", line_head->file->filename,
+ gfc_status ("%s:%3d %s\n",
#ifdef USE_MAPPED_LOCATION
+ LOCATION_FILE (line_head->location),
LOCATION_LINE (line_head->location),
#else
+ line_head->file->filename,
line_head->linenum,
#endif
line_head->line);



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