The recommended bits reserved in a line_map to store ranges has always been
5, meaning that identifiers up to length 32 can be stored without generating
an ad-hoc location. When 64-bit location_t is configured, there are plenty
of bits to go around, and so the recommended default is larger. line-map.h
now exports the recommended setting based on what was configured, so make
use of that when setting up the line map rather than hard-coding 5.

Also silently ignore -flarge-source-files when configured with 64-bit
location_t. That flag is a workaround for cases where we run out of 32-bit
location_t entries; it effectively makes every token's location an ad-hoc
location, making more of the location_t space available for tracking source
locations. This workaround is not necessary with a 64-bit location_t.

gcc/ChangeLog:

        * toplev.cc (general_init): Use constant
        line_map_suggested_range_bits instead of hard-coded integer.
        (process_options): Silently ignore -flarge-source-files if 64-bit
        location_t is in use.
---
 gcc/toplev.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gcc/toplev.cc b/gcc/toplev.cc
index 779049674b4..655be409a36 100644
--- a/gcc/toplev.cc
+++ b/gcc/toplev.cc
@@ -1137,7 +1137,7 @@ general_init (const char *argv0, bool init_signals, 
unique_argv original_argv)
   linemap_init (line_table, BUILTINS_LOCATION);
   line_table->m_reallocator = realloc_for_line_map;
   line_table->m_round_alloc_size = ggc_round_alloc_size;
-  line_table->default_range_bits = 5;
+  line_table->default_range_bits = line_map_suggested_range_bits;
   init_ttree ();
 
   /* Initialize register usage now so switches may override.  */
@@ -1765,8 +1765,10 @@ process_options ()
     hash_table_sanitize_eq_limit
       = param_hash_table_verification_limit;
 
+  #ifndef ENABLE_LARGE_SOURCE_LOCATIONS
   if (flag_large_source_files)
     line_table->default_range_bits = 0;
+  #endif
 
   diagnose_options (&global_options, &global_options_set, UNKNOWN_LOCATION);
 

Reply via email to