[Bug preprocessor/100142] [11 Regression] ICE in linemap_position_for_loc_and_offset, at libcpp/line-map.c:1004 since r11-8150-g4acb3af3669db4ca

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Apr 19 07:37:41 GMT 2021


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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
diff --git a/libcpp/line-map.c b/libcpp/line-map.c
index 2f5e44447d2..a03d6760a8e 100644
--- a/libcpp/line-map.c
+++ b/libcpp/line-map.c
@@ -982,7 +982,7 @@ linemap_position_for_loc_and_offset (line_maps *set,
      the next line map of the set.  Otherwise, we try to encode the
      location in the next map.  */
   for (; map != LINEMAPS_LAST_ORDINARY_MAP (set)
-        && (loc + (column << map->m_range_bits)
+        && (loc + (column_offset << map->m_range_bits)
             >= MAP_START_LOCATION (map + 1)); map++)
     /* If the next map is a different file, or starts in a higher line, we
        cannot encode the location there.  */

fixes it (pasto in original fix?) and seems to preserve fixing the original PR
(but that had no testcase added).


More information about the Gcc-bugs mailing list