http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47201

           Summary: [4.6 Regression] ICE: SIGSEGV in adjust_mems
                    (var-tracking.c:814) with -O -fPIC -g
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: zso...@seznam.cz
              Host: x86_64-pc-linux-gnu
            Target: x86_64-pc-linux-gnu


Created attachment 22919
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22919
reduced testcase

valgrind output:
$ gcc -O -fPIC -g testcase.c
==20054== Invalid read of size 2
==20054==    at 0xA70C22: adjust_mems (var-tracking.c:814)
==20054==    by 0x8C08FE: simplify_replace_fn_rtx (simplify-rtx.c:371)
==20054==    by 0xA6D075: adjust_mem_uses (var-tracking.c:930)
==20054==    by 0x86387D: note_uses (rtlanal.c:1524)
==20054==    by 0xA7756B: vt_initialize (var-tracking.c:1016)
==20054==    by 0xA80226: variable_tracking_main (var-tracking.c:8532)
==20054==    by 0x7F1F65: execute_one_pass (passes.c:1553)
==20054==    by 0x7F2254: execute_pass_list (passes.c:1608)
==20054==    by 0x7F2266: execute_pass_list (passes.c:1609)
==20054==    by 0x7F2266: execute_pass_list (passes.c:1609)
==20054==    by 0x932325: tree_rest_of_compilation (tree-optimize.c:422)
==20054==    by 0xAF74A1: cgraph_expand_function (cgraphunit.c:1519)
==20054==    by 0xAF9B69: cgraph_optimize (cgraphunit.c:1578)
==20054==    by 0xAFA0E9: cgraph_finalize_compilation_unit (cgraphunit.c:1042)
==20054==    by 0x509D6B: c_write_global_declarations (c-decl.c:9843)
==20054==    by 0x8DBAF5: toplev_main (toplev.c:591)
==20054==    by 0x6369BBC: (below main) (in /lib64/libc-2.11.2.so)
==20054==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==20054== 
testcase.c: In function 'foo':
testcase.c:13:1: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.



Program received signal SIGSEGV, Segmentation fault.
0x0000000000a70c22 in adjust_mems (loc=0x7ffff5d2d498, old_rtx=0x0,
data=0x7fffffffd740)
    at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/var-tracking.c:814
814               if (mem != loc && !MEM_P (mem))
(gdb) bt
#0  0x0000000000a70c22 in adjust_mems (loc=0x7ffff5d2d498, old_rtx=0x0,
data=0x7fffffffd740)
    at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/var-tracking.c:814
#1  0x00000000008c08ff in simplify_replace_fn_rtx (x=0x7ffff5d2d498,
old_rtx=0x0, fn=0xa70500 <adjust_mems>, 
    data=0x7fffffffd740) at
/usr/portage/distfiles/svn-src/gcc/trunk/gcc/simplify-rtx.c:371
#2  0x0000000000a6d076 in adjust_mem_uses (x=0x7ffff5cd1c28, data=<value
optimized out>)
    at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/var-tracking.c:930
#3  0x000000000086387e in note_uses (pbody=<value optimized out>, fun=0xa6d060
<adjust_mem_uses>, data=0x7fffffffd740)
    at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/rtlanal.c:1524
#4  0x0000000000a7756c in adjust_insn () at
/usr/portage/distfiles/svn-src/gcc/trunk/gcc/var-tracking.c:1016
#5  vt_initialize () at
/usr/portage/distfiles/svn-src/gcc/trunk/gcc/var-tracking.c:8375
#6  0x0000000000a80227 in variable_tracking_main_1 () at
/usr/portage/distfiles/svn-src/gcc/trunk/gcc/var-tracking.c:8532
#7  variable_tracking_main () at
/usr/portage/distfiles/svn-src/gcc/trunk/gcc/var-tracking.c:8584
#8  0x00000000007f1f66 in execute_one_pass (pass=0x163b620) at
/usr/portage/distfiles/svn-src/gcc/trunk/gcc/passes.c:1553
#9  0x00000000007f2255 in execute_pass_list (pass=0x163b620) at
/usr/portage/distfiles/svn-src/gcc/trunk/gcc/passes.c:1608
#10 0x00000000007f2267 in execute_pass_list (pass=0x16381a0) at
/usr/portage/distfiles/svn-src/gcc/trunk/gcc/passes.c:1609
#11 0x00000000007f2267 in execute_pass_list (pass=0x1638200) at
/usr/portage/distfiles/svn-src/gcc/trunk/gcc/passes.c:1609
#12 0x0000000000932326 in tree_rest_of_compilation (fndecl=0x7ffff5cc3f00)
    at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/tree-optimize.c:422
#13 0x0000000000af74a2 in cgraph_expand_function (node=0x7ffff5cc8160)
    at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cgraphunit.c:1519
#14 0x0000000000af9b6a in cgraph_expand_all_functions () at
/usr/portage/distfiles/svn-src/gcc/trunk/gcc/cgraphunit.c:1578
#15 cgraph_optimize () at
/usr/portage/distfiles/svn-src/gcc/trunk/gcc/cgraphunit.c:1838
#16 0x0000000000afa0ea in cgraph_finalize_compilation_unit ()
    at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/cgraphunit.c:1042
#17 0x0000000000509d6c in c_write_global_declarations () at
/usr/portage/distfiles/svn-src/gcc/trunk/gcc/c-decl.c:9843
#18 0x00000000008dbaf6 in compile_file (argc=15, argv=0x7fffffffdab8)
    at /usr/portage/distfiles/svn-src/gcc/trunk/gcc/toplev.c:591
#19 do_compile (argc=15, argv=0x7fffffffdab8) at
/usr/portage/distfiles/svn-src/gcc/trunk/gcc/toplev.c:1874
#20 toplev_main (argc=15, argv=0x7fffffffdab8) at
/usr/portage/distfiles/svn-src/gcc/trunk/gcc/toplev.c:1937
#21 0x00007ffff6586bbd in __libc_start_main () from /lib/libc.so.6
#22 0x00000000004f0955 in _start ()

Reply via email to