http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58759
Jeffrey A. Law <law at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |law at redhat dot com
--- Comment #4 from Jeffrey A. Law <law at redhat dot com> ---
I don't offhand see how this can be a jump threading problem.
./xgcc -B./ -O2 -fdbg-cnt=registered_jump_thread:0 j.c -m32 -g
-fdump-tree-all-blocks-vops-details -dap -S
[law@lugnut gcc]$ ./xgcc -B./ -O2 -fdbg-cnt=registered_jump_thread:0 j.c -m32
dbg_cnt 'registered_jump_thread' set to 0
[law@lugnut gcc]$ ./a.out
Segmentation fault (core dumped)
Note carefully the -fdbg-cnt flag. That turns off jump threading.
Using gdb and the raw assembly code we have the following faulting instruction
(shortly after the call to foo():
movl %edx, i+12
Hmm, that's strange since "i" is in readonly memory:
.section .rodata
.align 4
.type i, @object
.size i, 16
i:
If we look at the faulting instruction in the .reload dump we have:
(insn 100 105 47 6 (set (mem/u/c:SI (const:SI (plus:SI (symbol_ref:SI ("i")
[flags 0x2] <var_decl 0x7f5ee20427b8 i>)
(const_int 12 [0xc]))) [4 i+12 S4 A32])
(reg:SI 1 dx [127])) j.c:30 86 {*movsi_internal}
(nil))
Yup, that's a write to readonly memory.