https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69650

--- Comment #16 from rguenther at suse dot de <rguenther at suse dot de> ---
On Wed, 23 Mar 2016, manu at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69650
> 
> --- Comment #15 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
> (In reply to Manuel López-Ibáñez from comment #14)
> > (In reply to rguent...@suse.de from comment #12)
> > > > This is an invalid linemarker. libcpp should ignore it completely and 
> > > > behave as
> > > > if it was not present. It seems it is not doing that for some reason 
> > > > and that
> > > > is messing up the line-table.
> > > 
> > > Sure, but I don't see that 1048539 line number anywhere so it feels like
> > > sth is used uninitialized?
> > 
> > This was thoroughly analyzed by David above. The invalid linemarker causes
> > an invalid LC_LEAVE which then triggers an invalid line-number calculation.
> > Somehow, the code for handling the invalid linemarker is doing the wrong
> > thing.
> 
> In any case, the current error-handling creates:
> 
> {<line_map> = {start_location = 8224, reason = LC_LEAVE}, to_file = 0x2154630
> "Unified_cpp_js_src35.ii", to_line = 1048576, included_from = -1, sysp = 0
> '\000', m_column_and_range_bits = 12, m_range_bits = 5}
> 
> in response to the invalid line-marker. Even if the to_line was correct, the
> linemarker was invalid, so this map does not even need to exist. The 
> line-table
> at the end should be the same as if the original file had '//' in front of #.

Index: libcpp/line-map.c
===================================================================
--- libcpp/line-map.c   (revision 234415)
+++ libcpp/line-map.c   (working copy)
@@ -543,7 +543,7 @@ linemap_add (struct line_maps *set, enum
                 to_file);

       /* A TO_FILE of NULL is special - we use the natural values.  */
-      if (error || to_file == NULL)
+      if (to_file == NULL)
        {
          to_file = ORDINARY_MAP_FILE_NAME (from);
          to_line = SOURCE_LINE (from, from[1].start_location);

"fixes" both issues, the diagnostic and the LTO ICE.

Reply via email to