Hi, another issue pointed out by valgrind:
==12724== Invalid write of size 8 ==12724== at 0xD03071: rest_of_handle_dse() (dse.c:2873) ==12724== by 0x82824A: execute_one_pass(opt_pass*) (passes.c:2328) ==12724== by 0x8286B4: execute_pass_list(opt_pass*) (passes.c:2386) ==12724== by 0x8286C6: execute_pass_list(opt_pass*) (passes.c:2387) ==12724== by 0x5ED641: expand_function(cgraph_node*) (cgraphunit.c:1641) ==12724== by 0x5EF406: compile() (cgraphunit.c:1745) ==12724== by 0x5EFAA9: finalize_compilation_unit() (cgraphunit.c:2120) ==12724== by 0x4D58AB: c_write_global_declarations() (c-decl.c:10120) ==12724== by 0x8C9CCC: compile_file() (toplev.c:559) ==12724== by 0x8CBBA9: toplev_main(int, char**) (toplev.c:1884) ==12724== by 0x4ECD884: (below main) (libc-start.c:258) ==12724== Address 0x538f7d0 is 112 bytes inside a block of size 11,208 alloc'd ==12724== at 0x4028ECB: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==12724== by 0xE04197: xmalloc (xmalloc.c:147) ==12724== by 0x57F378: pool_alloc(alloc_pool_def*) (alloc-pool.c:282) ==12724== by 0xD0263C: record_store(rtx_def*, bb_info*) (dse.c:1544) ==12724== by 0xD0342C: rest_of_handle_dse() (dse.c:2675) ==12724== by 0x82824A: execute_one_pass(opt_pass*) (passes.c:2328) ==12724== by 0x8286B4: execute_pass_list(opt_pass*) (passes.c:2386) ==12724== by 0x8286C6: execute_pass_list(opt_pass*) (passes.c:2387) ==12724== by 0x5ED641: expand_function(cgraph_node*) (cgraphunit.c:1641) ==12724== by 0x5EF406: compile() (cgraphunit.c:1745) ==12724== by 0x5EFAA9: finalize_compilation_unit() (cgraphunit.c:2120) ==12724== by 0x4D58AB: c_write_global_declarations() (c-decl.c:10120) ==12724== The problem here is that "s_info->redundant_reason" may point to garbage after "delete_dead_store_insn (ptr)". As Jakub pointed out in the PR the clearing of the field is superfluous. So just delete the lines completely. Bootstrapped and tested on x86_64-pc-linux-gnu. Please apply. Thanks. 2012-11-28 Markus Trippelsdorf <mar...@trippelsdorf.de> PR other/55358 * dse.c (rest_of_handle_dse): Remove superfluous clearing. diff --git a/gcc/dse.c b/gcc/dse.c index f879adb..6a530ca 100644 --- a/gcc/dse.c +++ b/gcc/dse.c @@ -2869,8 +2869,6 @@ dse_step1 (void) INSN_UID (s_info->redundant_reason->insn)); delete_dead_store_insn (ptr); } - if (s_info) - s_info->redundant_reason = NULL; free_store_info (ptr); } else -- Markus