[rfa] valops.c - simplify hand_function_call's push struct logic

Andrew Cagney ac131313@cygnus.com
Mon Mar 19 12:06:00 GMT 2001


FYI,

I've checked this in.

	Andrew


To : GDB Patches <gdb-patches at sourceware dot cygnus dot com>
Subject : [rfa] valops.c - simplify hand_function_call's push struct logic
>From : Andrew Cagney <ac131313 at cygnus dot com>
Date : Mon, 27 Nov 2000 18:28:10 +1100

Hello,

The attatched patch should simplify the logic used when computing the
address at which the return struct is pushed.  It also eliminates a
-Wuninitialized warning.

I think it is ok.

	Andrew
Mon Nov 20 13:59:29 2000  Andrew Cagney  <cagney@b1.cygnus.com>

	* valops.c (hand_function_call): Simplify computation of address
 	of the pushed argument.
 
Index: valops.c
===================================================================
RCS file: /cvs/src/src/gdb/valops.c,v
retrieving revision 1.27
diff -u -r1.27 valops.c
--- valops.c	2000/11/08 05:10:18	1.27
+++ valops.c	2000/11/27 07:29:27
@@ -1520,26 +1520,19 @@
 		{
 		  /* stack grows downward */
 		  sp -= aligned_len;
+		  /* ... so the address of the thing we push is the
+		     stack pointer after we push it.  */
+		  addr = sp;
 		}
 	      else
 		{
 		  /* The stack grows up, so the address of the thing
 		     we push is the stack pointer before we push it.  */
 		  addr = sp;
-		}
-	      /* Push the structure.  */
-	      write_memory (sp, VALUE_CONTENTS_ALL (args[i]), len);
-	      if (INNER_THAN (1, 2))
-		{
-		  /* The stack grows down, so the address of the thing
-		     we push is the stack pointer after we push it.  */
-		  addr = sp;
-		}
-	      else
-		{
-		  /* stack grows upward */
 		  sp += aligned_len;
 		}
+	      /* Push the structure.  */
+	      write_memory (addr, VALUE_CONTENTS_ALL (args[i]), len);
 	      /* The value we're going to pass is the address of the
 		 thing we just pushed.  */
 	      /*args[i] = value_from_longest (lookup_pointer_type (value_type),


More information about the Gdb-patches mailing list