This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] for PR17723


Hello,

cfgcleanup.c:merge_memattrs assumes that MEM_SIZE is not NULL.  As far
as I can tell from other code, this is wrong (it is checked for it
elsewhere), although I haven't seen it explicitly documented.

This patch fixes the problem in obvious manner.

Bootstrapped & regtested on i686.

Zdenek

	PR rtl-optimization/17723
	* cfgcleanup.c (merge_memattrs): Handle case when
	MEM_SIZE == NULL_RTX.

Index: cfgcleanup.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgcleanup.c,v
retrieving revision 1.131
diff -c -3 -p -r1.131 cfgcleanup.c
*** cfgcleanup.c	28 Sep 2004 07:59:42 -0000	1.131
--- cfgcleanup.c	10 Oct 2004 11:34:28 -0000
*************** merge_memattrs (rtx x, rtx y)
*** 934,939 ****
--- 934,941 ----
  	MEM_ATTRS (x) = 0;
        else 
  	{
+ 	  rtx mem_size;
+ 
  	  if (MEM_ALIAS_SET (x) != MEM_ALIAS_SET (y))
  	    {
  	      set_mem_alias_set (x, 0);
*************** merge_memattrs (rtx x, rtx y)
*** 952,961 ****
  	      set_mem_offset (x, 0);
  	      set_mem_offset (y, 0);
  	    }
! 	  
! 	  set_mem_size (x, GEN_INT (MAX (INTVAL (MEM_SIZE (x)),
! 					 INTVAL (MEM_SIZE (y)))));
! 	  set_mem_size (y, MEM_SIZE (x));
  
  	  set_mem_align (x, MIN (MEM_ALIGN (x), MEM_ALIGN (y)));
  	  set_mem_align (y, MEM_ALIGN (x));
--- 954,969 ----
  	      set_mem_offset (x, 0);
  	      set_mem_offset (y, 0);
  	    }
! 	 
! 	  if (!MEM_SIZE (x))
! 	    mem_size = NULL_RTX;
! 	  else if (!MEM_SIZE (y))
! 	    mem_size = NULL_RTX;
! 	  else
! 	    mem_size = GEN_INT (MAX (INTVAL (MEM_SIZE (x)),
! 				     INTVAL (MEM_SIZE (y))));
! 	  set_mem_size (x, mem_size);
! 	  set_mem_size (y, mem_size);
  
  	  set_mem_align (x, MIN (MEM_ALIGN (x), MEM_ALIGN (y)));
  	  set_mem_align (y, MEM_ALIGN (x));


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]