public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/107818] New: Overflow of linemap breaks its chronological order
@ 2022-11-22 15:01 fxue at os dot amperecomputing.com
  2023-02-23 18:14 ` [Bug preprocessor/107818] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: fxue at os dot amperecomputing.com @ 2022-11-22 15:01 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug preprocessor/107818] Overflow of linemap breaks its chronological order
  2022-11-22 15:01 [Bug tree-optimization/107818] New: Overflow of linemap breaks its chronological order fxue at os dot amperecomputing.com
@ 2023-02-23 18:14 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-02-23 18:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
include/line-map.h:const location_t LINE_MAP_MAX_LOCATION_WITH_PACKED_RANGES =
0x50000000;
include/line-map.h:const location_t LINE_MAP_MAX_LOCATION_WITH_COLS =
0x60000000;
include/line-map.h:const location_t LINE_MAP_MAX_LOCATION = 0x70000000;

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-02-23 18:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-22 15:01 [Bug tree-optimization/107818] New: Overflow of linemap breaks its chronological order fxue at os dot amperecomputing.com
2023-02-23 18:14 ` [Bug preprocessor/107818] " pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).