diff mbox

Fix up recent bootstrap regressions in cselib (PR bootstrap/51725)

Message ID 20120102195941.GP18937@tyan-ft48-01.lab.bos.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek Jan. 2, 2012, 7:59 p.m. UTC
Hi!

As discussed in the PR, the problem here is that when add_mem_for_addr
calls new_elt_loc_list, it adds the new MEM loc to canonical_cselib_val's
locs, so when mem_elt isn't canonical, we enter into addr_list as well as
first_containing_mem chain some VALUE that doesn't contain any MEM locs.
The check to avoid the duplicates isn't working either, because the only
loc non-canonical values have is the canonical VALUE.
While perhaps some more changes are needed and perhaps cselib_invalidate_mem
might need to call canonical_cselib_val too, I believe this patch is
correct and desirable and fixes both the ICEs I've analysed.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2012-01-02  Jakub Jelinek  <jakub@redhat.com>

	PR bootstrap/51725
	* cselib.c (add_mem_for_addr): Call canonical_cselib_val
	on mem_elt first.


	Jakub

Comments

Richard Henderson Jan. 2, 2012, 8:51 p.m. UTC | #1
On 01/03/2012 06:59 AM, Jakub Jelinek wrote:
> 	PR bootstrap/51725
> 	* cselib.c (add_mem_for_addr): Call canonical_cselib_val
> 	on mem_elt first.

Ok.


r~
diff mbox

Patch

--- gcc/cselib.c.jj	2012-01-01 19:54:46.000000000 +0100
+++ gcc/cselib.c	2012-01-02 17:34:16.982499767 +0100
@@ -1264,6 +1264,8 @@  add_mem_for_addr (cselib_val *addr_elt,
 {
   struct elt_loc_list *l;
 
+  mem_elt = canonical_cselib_val (mem_elt);
+
   /* Avoid duplicates.  */
   for (l = mem_elt->locs; l; l = l->next)
     if (MEM_P (l->loc)