This is the mail archive of the gcc-bugs@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]

[Bug middle-end/56231] warning traces have bogus line information when using LTO


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56231

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> 2013-02-07 14:01:50 UTC ---
(In reply to comment #1)
> Index: gcc/lto-streamer-in.c
> ===================================================================
> --- gcc/lto-streamer-in.c       (revision 195841)
> +++ gcc/lto-streamer-in.c       (working copy)
> @@ -164,13 +164,8 @@ lto_input_location (struct bitpack_d *bp
>      data_in->current_col = bp_unpack_var_len_unsigned (bp);
> 
>    if (file_change)
> -    {
> -      if (prev_file)
> -       linemap_add (line_table, LC_LEAVE, false, NULL, 0);
> -
> -      linemap_add (line_table, LC_ENTER, false, data_in->current_file,
> -                  data_in->current_line);
> -    }
> +    linemap_add (line_table, LC_RENAME, false, data_in->current_file,
> +                data_in->current_line);
>    else if (line_change)
>      linemap_line_start (line_table, data_in->current_line,
> data_in->current_col);

Does not work because of

const struct line_map *
linemap_add (struct line_maps *set, enum lc_reason reason,
             unsigned int sysp, const char *to_file, linenum_type to_line)
{
...
  /* When we enter the file for the first time reason cannot be
     LC_RENAME.  */
  linemap_assert (!(set->depth == 0 && reason == LC_RENAME));

trying

Index: gcc/lto-streamer-in.c
===================================================================
--- gcc/lto-streamer-in.c       (revision 195846)
+++ gcc/lto-streamer-in.c       (working copy)
@@ -165,11 +165,12 @@ lto_input_location (struct bitpack_d *bp

   if (file_change)
     {
-      if (prev_file)
-       linemap_add (line_table, LC_LEAVE, false, NULL, 0);
-
-      linemap_add (line_table, LC_ENTER, false, data_in->current_file,
-                  data_in->current_line);
+      if (!prev_file)
+       linemap_add (line_table, LC_ENTER, false, data_in->current_file,
+                    data_in->current_line);
+      else
+       linemap_add (line_table, LC_RENAME, false, data_in->current_file,
+                    data_in->current_line);
     }
   else if (line_change)
     linemap_line_start (line_table, data_in->current_line,
data_in->current_col);

we'll still eventually enter a file multiple times that way.  But let's see
if it makes a difference...


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