[Bug c/66415] [6 Regression] ice in location_column_from_byte_offset

mpolacek at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Jun 4 08:50:00 GMT 2015


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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu.org

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Thus:

--- a/gcc/c-family/c-format.c
+++ b/gcc/c-family/c-format.c
@@ -142,9 +142,11 @@ location_from_offset (location_t loc, int offset)
   expanded_location s = expand_location_to_spelling_point (loc);
   int line_width;
   const char *line = location_get_source_line (s, &line_width);
+  if (line == NULL)
+    return loc;
   line += s.column - 1 ;
   line_width -= s.column - 1;
-  unsigned int column = 
+  unsigned int column =
     location_column_from_byte_offset (line, line_width, (unsigned) offset);

   return linemap_position_for_loc_and_offset (line_table, loc, column);

Manuel, does that look fine to you?

Most likely started with r223470.  Trying to reduce ...



More information about the Gcc-bugs mailing list