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]

[PATCH] alpha_expand_block_move fix


Hi!

tmp in alpha_expand_block_move is already XEXP (XEXP (MEM, 0), 0), ie. the
first argument of addressof, so I don't see why we should dive any deeper,
especially when tmp can be e.g. a REG.
A testcase could be, which I'm not sure if it should be put into testsuite
since it has undefined behaviour (copies more than sizeof (d)).
Ok to commit?

typedef __SIZE_TYPE__ size_t;
extern void *memcpy (void *, const void *, size_t);

int foo (void *a, unsigned long b)
{
  int c = sizeof(unsigned long) * 8;
  float d;

  if (a) {
    d = (float) b;
    memcpy ((void *) &b, (void *) &d, sizeof(unsigned long));
  }
  return c;
}

2001-01-12  Jakub Jelinek  <jakub@redhat.com>

	* config/alpha/alpha.c (alpha_expand_block_move): GET_MODE of tmp,
	not XEXP (tmp, 0).

--- gcc/config/alpha/alpha.c.jj	Fri Jan 12 11:35:40 2001
+++ gcc/config/alpha/alpha.c	Fri Jan 12 13:16:51 2001
@@ -2923,7 +2923,7 @@ alpha_expand_block_move (operands)
       /* No appropriate mode; fall back on memory.  */
       orig_src = change_address (orig_src, GET_MODE (orig_src),
 				 copy_addr_to_reg (XEXP (orig_src, 0)));
-      src_align = GET_MODE_BITSIZE (GET_MODE (XEXP (tmp, 0)));
+      src_align = GET_MODE_BITSIZE (GET_MODE (tmp));
     }
 
   ofs = 0;
@@ -3077,7 +3077,7 @@ alpha_expand_block_move (operands)
 	 up by recognizing extra alignment information.  */
       orig_dst = change_address (orig_dst, GET_MODE (orig_dst),
 				 copy_addr_to_reg (XEXP (orig_dst, 0)));
-      dst_align = GET_MODE_BITSIZE (GET_MODE (XEXP (tmp, 0)));
+      dst_align = GET_MODE_BITSIZE (GET_MODE (tmp));
     }
 
   /* Write out the data in whatever chunks reading the source allowed.  */

	Jakub

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