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

            Bug ID: 107818
           Summary: Overflow of linemap breaks its chronological order
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fxue at os dot amperecomputing.com
  Target Milestone: ---

Large-size source codes might exceed representation space of linemap. When this
happens, UNKNOWN_LOCATION(0) would inserted to the end of linemap. And the
action breaks the order constraint on the map, which requires all logical
locations contained by it should remain chronologically-ordered, so that binary
search could be used.(Comments in linemap_ordinary_map_lookup).


In the function "linemap_add":

  ...

  if (start_location >= LINE_MAP_MAX_LOCATION)
    /* We ran out of line map space.   */
    start_location = 0;

  line_map_ordinary *map
    = linemap_check_ordinary (new_linemap (set, start_location));
                              ^^^^^^^^^^^
                              UNKNOWN_LOCATION(0) is also added to linemap
  map->reason = reason;
  ...


Afterwards, logical location to source line would be mis-translated.

pr86872 only partially fixed see-able ICE due to linemap overflow, but made a
this hidden issue.

Reply via email to