Patchwork Combine location with block using block_locations

login
register
mail settings
Submitter Dehao Chen
Date Sept. 13, 2012, 7:10 a.m.
Message ID <CAO2gOZXV-mabfBX=nK5pQsRMGGus2GoBiLSRgJDmh_wuBM7RQQ@mail.gmail.com>
Download mbox | patch
Permalink /patch/183516/
State New
Headers show

Comments

Dehao Chen - Sept. 13, 2012, 7:10 a.m.
I can reproduce the error. For large applications, the 32bit integer
will overflow (not enough to encode the locations). The following
patch can fix the problem. I'm still doing integration tests, and will
send out a integral patch tomorrow.

Thanks,
Dehao

        }


On Tue, Sep 11, 2012 at 12:41 AM, Jan Hubicka <hubicka@ucw.cz> wrote:
> Hi,
> I was curious how the patch behaves memory wise on compilling Mozilla.  It actually crashes on:
> (gdb) bt
> #0  0x00007fab8cd70945 in raise () from /lib64/libc.so.6
> #1  0x00007fab8cd71f21 in abort () from /lib64/libc.so.6
> #2  0x0000000000b52330 in linemap_location_from_macro_expansion_p (set=0x7805, location=30725) at ../../libcpp/line-map.c:952
> #3  0x0000000000b526fc in linemap_lookup (set=0x7fab8dc34000, line=0) at ../../libcpp/line-map.c:644
> #4  0x0000000000776745 in maybe_unwind_expanded_macro_loc (where=0, diagnostic=<optimized out>, context=<optimized out>) at ../../gcc/tree-diagnostic.c:113
> #5  virt_loc_aware_diagnostic_finalizer (context=0x11b8a80, diagnostic=0x7fff4d8adf90) at ../../gcc/tree-diagnostic.c:282
> #6  0x0000000000b4aa80 in diagnostic_report_diagnostic (context=0x11b8a80, diagnostic=0x7fff4d8adf90) at ../../gcc/diagnostic.c:652
> #7  0x0000000000b4acd6 in internal_error (gmsgid=<optimized out>) at ../../gcc/diagnostic.c:957
> #8  0x00000000007555c0 in crash_signal (signo=11) at ../../gcc/toplev.c:335
> #9  <signal handler called>
> #10 0x0000000000b526e8 in linemap_lookup (set=0x7fab8dc34000, line=4294967295) at ../../libcpp/line-map.c:643
> #11 0x0000000000b530fa in linemap_location_in_system_header_p (set=0x7fab8dc34000, location=4294967295) at ../../libcpp/line-map.c:916
> #12 0x0000000000b4a8b2 in diagnostic_report_diagnostic (context=0x11b8a80, diagnostic=0x7fff4d8ae620) at ../../gcc/diagnostic.c:513
> #13 0x0000000000b4b462 in warning_at (location=<optimized out>, opt=0, gmsgid=<optimized out>) at ../../gcc/diagnostic.c:805
> #14 0x0000000000699679 in lto_symtab_merge_decls_2 (diagnosed_p=<optimized out>, slot=<optimized out>) at ../../gcc/lto-symtab.c:574
> #15 lto_symtab_merge_decls_1 (slot=<optimized out>, data=<optimized out>) at ../../gcc/lto-symtab.c:691
> #16 0x0000000000bd32e8 in htab_traverse_noresize (htab=<optimized out>, callback=0x698ed0 <lto_symtab_merge_decls_1(void**, void*)>, info=0x0) at ../../libiberty/hashtab.c:784
> #17 0x00000000004e2630 in read_cgraph_and_symbols (nfiles=2849, fnames=<optimized out>) at ../../gcc/lto/lto.c:1824
> #18 0x00000000004e2b75 in lto_main () at ../../gcc/lto/lto.c:2107
>
> It seems that warning_at is not really able to lookup the position.
>
> Honza

Patch

diff --git a/libcpp/line-map.c b/libcpp/line-map.c
index 8091e9b..14703c8 100644
--- a/libcpp/line-map.c
+++ b/libcpp/line-map.c
@@ -538,12 +540,12 @@  linemap_line_start (struct line_maps *set,
linenum_type to_line,
   if (add_map)
     {
       int column_bits;
-      if (max_column_hint > 100000 || highest > 0xC0000000)
+      if (max_column_hint > 100000 || highest > 0x60000000)
        {
          /* If the column number is ridiculous or we've allocated a huge
             number of source_locations, give up on column numbers. */
          max_column_hint = 0;
-         if (highest >0xF0000000)
+         if (highest >0x70000000)
            return 0;
          column_bits = 0;