+2003-05-18 Roger Sayle <roger@eyesopen.com>
+ Zack Weinberg <zack@codesourcery.com>
+
+ PR middle-end/10472
+ * builtins.c (expand_builtin_memcpy): Call force_operand on
+ expressions and use simplify_gen_binary to create the addition.
+
2003-05-18 Andreas Schwab <schwab@suse.de>
* config/m68k/m68k.md: Use define_constants for unspec numbers.
#endif
if (endp)
{
- rtx result = gen_rtx_PLUS (GET_MODE (dest_mem), dest_mem, len_rtx);
+ rtx result;
+ rtx delta = len_rtx;
+
if (endp == 2)
- result = simplify_gen_binary (MINUS, GET_MODE (result), result, const1_rtx);
- return result;
+ delta = GEN_INT (INTVAL (delta) - 1);
+
+ result = simplify_gen_binary (PLUS, GET_MODE (dest_mem),
+ dest_mem, delta);
+ return force_operand (result, NULL_RTX);
}
else
return dest_mem;
if (endp)
{
- rtx result = gen_rtx_PLUS (GET_MODE (dest_addr), dest_addr, len_rtx);
+ rtx result = force_operand (len_rtx, NULL_RTX);
+
if (endp == 2)
- result = simplify_gen_binary (MINUS, GET_MODE (result), result, const1_rtx);
- return result;
+ {
+ result = simplify_gen_binary (MINUS, GET_MODE (result),
+ result, const1_rtx);
+ result = force_operand (result, NULL_RTX);
+ }
+
+ result = simplify_gen_binary (PLUS, GET_MODE (dest_addr),
+ dest_addr, result);
+ return force_operand (result, NULL_RTX);
}
else
return dest_addr;
+2003-05-18 Roger Sayle <roger@eyesopen.com>
+ Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * gcc.c-torture/compile/20030518-1.c: New test case.
+
2003-05-18 Mark Mitchell <mark@codesourcery.com>
* lib/gcc-dg.exp (gcc-dg-debug-runtest): Add opt_opts parameter.
--- /dev/null
+/* Test case from PR middle-end/10472 */
+
+extern void f (char *);
+
+void foo (char *s)
+{
+ f (__builtin_stpcpy (s, "hi"));
+}
+
+void bar (char *s)
+{
+ f (__builtin_mempcpy (s, "hi", 3));
+}
+