public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix (part of) PR55358
@ 2012-11-28 15:19 Markus Trippelsdorf
  2012-11-28 17:12 ` Jakub Jelinek
  0 siblings, 1 reply; 2+ messages in thread
From: Markus Trippelsdorf @ 2012-11-28 15:19 UTC (permalink / raw)
  To: gcc-patches; +Cc: jakub

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  <markus@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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix (part of) PR55358
  2012-11-28 15:19 [PATCH] Fix (part of) PR55358 Markus Trippelsdorf
@ 2012-11-28 17:12 ` Jakub Jelinek
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Jelinek @ 2012-11-28 17:12 UTC (permalink / raw)
  To: Markus Trippelsdorf; +Cc: gcc-patches

On Wed, Nov 28, 2012 at 04:18:44PM +0100, Markus Trippelsdorf wrote:
> Bootstrapped and tested on x86_64-pc-linux-gnu. Please apply.
> Thanks.
> 
> 2012-11-28  Markus Trippelsdorf  <markus@trippelsdorf.de>
> 
> 	PR other/55358
> 	* dse.c (rest_of_handle_dse): Remove superfluous clearing.

Committed.  Thanks.

	Jakub

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-11-28 17:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-28 15:19 [PATCH] Fix (part of) PR55358 Markus Trippelsdorf
2012-11-28 17:12 ` Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).