Patchwork [spu] fix spu_function_arg thinkos

login
register
mail settings
Submitter Nathan Froyd
Date Oct. 21, 2010, 9:43 p.m.
Message ID <20101021214303.GP2806@nightcrawler>
Download mbox | patch
Permalink /patch/68782/
State New
Headers show

Comments

Nathan Froyd - Oct. 21, 2010, 9:43 p.m.
When I made my FUNCTION_ARG hookization changes for spu, I didn't look
very closely at the compiler warnings: if I had, I would have noticed
that I changed the type of the CUM parameter without changing its uses.

Fixed in the following way, verified with a cross to spu-elf.  Committed
as obvious.

-Nathan

	* config/spu/spu.c (spu_function_arg): Dereference CUM parameter.

Patch

Index: config/spu/spu.c
===================================================================
--- config/spu/spu.c	(revision 165789)
+++ config/spu/spu.c	(working copy)
@@ -4021,7 +4021,7 @@  spu_function_arg (CUMULATIVE_ARGS *cum,
 {
   int byte_size;
 
-  if (cum >= MAX_REGISTER_ARGS)
+  if (*cum >= MAX_REGISTER_ARGS)
     return 0;
 
   byte_size = ((mode == BLKmode)
@@ -4029,7 +4029,7 @@  spu_function_arg (CUMULATIVE_ARGS *cum,
 
   /* The ABI does not allow parameters to be passed partially in
      reg and partially in stack. */
-  if ((cum + (byte_size + 15) / 16) > MAX_REGISTER_ARGS)
+  if ((*cum + (byte_size + 15) / 16) > MAX_REGISTER_ARGS)
     return 0;
 
   /* Make sure small structs are left justified in a register. */
@@ -4042,12 +4042,12 @@  spu_function_arg (CUMULATIVE_ARGS *cum,
 	byte_size = 4;
       smode = smallest_mode_for_size (byte_size * BITS_PER_UNIT, MODE_INT);
       gr_reg = gen_rtx_EXPR_LIST (VOIDmode,
-				  gen_rtx_REG (smode, FIRST_ARG_REGNUM + cum),
+				  gen_rtx_REG (smode, FIRST_ARG_REGNUM + *cum),
 				  const0_rtx);
       return gen_rtx_PARALLEL (mode, gen_rtvec (1, gr_reg));
     }
   else
-    return gen_rtx_REG (mode, FIRST_ARG_REGNUM + cum);
+    return gen_rtx_REG (mode, FIRST_ARG_REGNUM + *cum);
 }
 
 static void