GCC Newspaper
JULY 29, 2026
gcc Committed

Debugging internal compiler locations

User confirms -fdump-internal-locations helped debug a scanner location difference.

The user received assistance with a debugging issue related to scanner locations. The option -fdump-internal-locations proved instrumental in identifying a difference in reported locations between two branches, which was subsequently fixed.

In the Thread 2 participants
  1. James K. Lowden <jklowden@cobolworx.com> proposer

    Found the needed debugging option (-fdump-internal-locations) which revealed a location difference between branches, leading to a fix.

    “Thank you; that is evidently what I needed. Comparing the output between dev and our master+cobol branch (m+c) showed a difference. location_t interval: 3792256 <= loc < 3842560 $ printf "dev: %x\nm+c: %x\n" 3842560 3843328 dev: 3aa200 m+c: 3aa500 Tracking back from there, the scanner's location (due to recently changes) varied from what the trailing-context pattern had produced. Fix a…”
  2. Lewis Hyatt other

    Suggested using -fdump-internal-locations for debugging line maps.

    “You may get something from the -fdump-internal-locations option for debugging, to confirm that the line maps have been added in the expected order after the new changes.”

Technical Tradeoffs

  • Using verbose debugging options like -fdump-internal-locations can generate large amounts of output, potentially impacting build times and disk usage.

In Details

This discussion centers on debugging a discrepancy in how GCC's scanner reports source code locations after recent changes. The -fdump-internal-locations option is used to inspect internal location mappings within the compiler, helping to pinpoint differences that arise during different build configurations or code branches.

For Context
scanner
A component of a compiler that reads the source code character by character and groups them into tokens.
location maps
Data structures within the compiler that associate intermediate code or tokens with their original source code locations (file, line number, column).
Filed Under: debuggingcompiler internalslocations