Commit 731ae8dd by Roger Sayle Committed by Roger Sayle

re PR middle-end/10472 (ICE in instantiate_virtual_regs_lossage)


	PR middle-end/10472
	* builtins.c (expand_builtin_memcpy):  Call force_operand on
	expressions and use simplify_gen_binary to create the addition.

	* gcc.c-torture/compile/20030518-1.c: New test case.

Co-Authored-By: Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
Co-Authored-By: Zack Weinberg <zack@codesourcery.com>

From-SVN: r66941
parent d1b3178b
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> 2003-05-18 Andreas Schwab <schwab@suse.de>
* config/m68k/m68k.md: Use define_constants for unspec numbers. * config/m68k/m68k.md: Use define_constants for unspec numbers.
......
...@@ -2311,10 +2311,15 @@ expand_builtin_memcpy (arglist, target, mode, endp) ...@@ -2311,10 +2311,15 @@ expand_builtin_memcpy (arglist, target, mode, endp)
#endif #endif
if (endp) if (endp)
{ {
rtx result = gen_rtx_PLUS (GET_MODE (dest_mem), dest_mem, len_rtx); rtx result;
rtx delta = len_rtx;
if (endp == 2) if (endp == 2)
result = simplify_gen_binary (MINUS, GET_MODE (result), result, const1_rtx); delta = GEN_INT (INTVAL (delta) - 1);
return result;
result = simplify_gen_binary (PLUS, GET_MODE (dest_mem),
dest_mem, delta);
return force_operand (result, NULL_RTX);
} }
else else
return dest_mem; return dest_mem;
...@@ -2338,10 +2343,18 @@ expand_builtin_memcpy (arglist, target, mode, endp) ...@@ -2338,10 +2343,18 @@ expand_builtin_memcpy (arglist, target, mode, endp)
if (endp) 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) 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 else
return dest_addr; 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> 2003-05-18 Mark Mitchell <mark@codesourcery.com>
* lib/gcc-dg.exp (gcc-dg-debug-runtest): Add opt_opts parameter. * lib/gcc-dg.exp (gcc-dg-debug-runtest): Add opt_opts parameter.
......
/* 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));
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment