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]

memcheck tests fail on mn10300


A couple of memcheck tests fail on mn10300 because, while expanding a
check_addr libcall, it ends up deciding it has to mark the stack
address used for the third argument as writable, starts the expansion
of a set_right libcall and messes it all up.

Since check_addr isn't checked, it doesn't its arguments to be
marked.  This patches avoid the unnecessary nested libcall expansion.
No regressions.  Ok to install?

Index: gcc/ChangeLog
from  Alexandre Oliva  <aoliva@cygnus.com>

	* expr.c (expand_assignment, store_expr, expand_expr,
	expand_expr_unaligned): Set in_check_memory_usage while emitting
	chkr_check_addr libcall.

Index: gcc/expr.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/expr.c,v
retrieving revision 1.240
diff -u -r1.240 expr.c
--- gcc/expr.c	2000/05/12 17:51:30	1.240
+++ gcc/expr.c	2000/05/24 11:29:53
@@ -3495,12 +3495,14 @@
 	  size *= GET_MODE_SIZE (best_mode);
 
 	  /* Check the access right of the pointer.  */
+	  in_check_memory_usage = 1;
 	  if (size)
 	    emit_library_call (chkr_check_addr_libfunc, 1, VOIDmode, 3,
 			       to_addr, Pmode,
 			       GEN_INT (size), TYPE_MODE (sizetype),
 			       GEN_INT (MEMORY_USE_WO),
 			       TYPE_MODE (integer_type_node));
+	  in_check_memory_usage = 0;
 	}
 
       /* If this is a varying-length object, we must get the address of
@@ -3877,6 +3879,7 @@
       && GET_CODE (target) == MEM
       && AGGREGATE_TYPE_P (TREE_TYPE (exp)))
     {
+      in_check_memory_usage = 1;
       if (GET_CODE (temp) == MEM)
         emit_library_call (chkr_copy_bitmap_libfunc, 1, VOIDmode, 3,
 			   XEXP (target, 0), Pmode,
@@ -3888,6 +3891,7 @@
 			   expr_size (exp), TYPE_MODE (sizetype),
 			   GEN_INT (MEMORY_USE_WO), 
 			   TYPE_MODE (integer_type_node));
+      in_check_memory_usage = 0;
     }
 
   /* If value was not generated in the target, store it there.
@@ -3991,12 +3995,14 @@
 	      if (size != const0_rtx)
 		{
 		  /* Be sure we can write on ADDR.  */
+		  in_check_memory_usage = 1;
 		  if (current_function_check_memory_usage)
 		    emit_library_call (chkr_check_addr_libfunc, 1, VOIDmode, 3,
 				       addr, Pmode,
 				       size, TYPE_MODE (sizetype),
  				       GEN_INT (MEMORY_USE_WO), 
 				       TYPE_MODE (integer_type_node));
+		  in_check_memory_usage = 0;
 		  clear_storage (gen_rtx_MEM (BLKmode, addr), size, align);
 		}
 
@@ -5919,6 +5925,7 @@
 	  enum memory_use_mode memory_usage;
 	  memory_usage = get_memory_usage_from_modifier (modifier);
 
+	  in_check_memory_usage = 1;
 	  if (memory_usage != MEMORY_USE_DONT)
 	    emit_library_call (chkr_check_addr_libfunc, 1, VOIDmode, 3,
 			       XEXP (DECL_RTL (exp), 0), Pmode,
@@ -5926,6 +5933,7 @@
 			       TYPE_MODE (sizetype),
 			       GEN_INT (memory_usage),
 			       TYPE_MODE (integer_type_node));
+	  in_check_memory_usage = 0;
 	}
 
       /* ... fall through ...  */
@@ -6755,6 +6763,7 @@
 		size = (bitpos % BITS_PER_UNIT) + bitsize + BITS_PER_UNIT - 1;
 
         	/* Check the access right of the pointer.  */
+		in_check_memory_usage = 1;
 		if (size > BITS_PER_UNIT)
 		  emit_library_call (chkr_check_addr_libfunc, 1, VOIDmode, 3,
 				     to, Pmode,
@@ -6762,6 +6771,7 @@
 				     TYPE_MODE (sizetype),
 				     GEN_INT (memory_usage), 
 				     TYPE_MODE (integer_type_node));
+		in_check_memory_usage = 0;
 	      }
 	  }
 
@@ -8717,12 +8727,14 @@
 	    size = (bitpos % BITS_PER_UNIT) + bitsize + BITS_PER_UNIT - 1;
 
 	    /* Check the access right of the pointer.  */
+	    in_check_memory_usage = 1;
 	    if (size > BITS_PER_UNIT)
 	      emit_library_call (chkr_check_addr_libfunc, 1, VOIDmode, 3,
 				 to, ptr_mode, GEN_INT (size / BITS_PER_UNIT),
 				 TYPE_MODE (sizetype),
 				 GEN_INT (MEMORY_USE_RO), 
 				 TYPE_MODE (integer_type_node));
+	    in_check_memory_usage = 0;
 	  }
 
 	/* In cases where an aligned union has an unaligned object

-- 
Alexandre Oliva    Enjoy Guaranį, see http://www.ic.unicamp.br/~oliva/
Cygnus Solutions, a Red Hat company        aoliva@{redhat, cygnus}.com
Free Software Developer and Evangelist    CS PhD student at IC-Unicamp
oliva@{lsd.ic.unicamp.br, gnu.org}   Write to mailing lists, not to me

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