re PR middle-end/27260 (ICE in expand_expr_real_1, at expr.c:6750)

gcc/
	PR middle-end/27260
	* builtins.c (expand_builtin_memset): Expand val in original mode.
gcc/testsuite/
	PR middle-end/27260
	* gcc.c-torture/execute/pr27260.c: New.

From-SVN: r113341
This commit is contained in:
Alan Modra 2006-04-28 13:11:34 +09:30
parent 5cd9edb524
commit bb6a0ee1c5
4 changed files with 46 additions and 3 deletions

View file

@ -1,3 +1,8 @@
2006-04-28 Alan Modra <amodra@bigpond.net.au>
PR middle-end/27260
* builtins.c (expand_builtin_memset): Expand val in original mode.
2006-04-27 Eric Christopher <echristo@apple.com>
* target-def.h (TARGET_SET_DEFAULT_TYPE_ATTRIBUTES): Bracket

View file

@ -3421,11 +3421,11 @@ expand_builtin_memset (tree arglist, rtx target, enum machine_mode mode,
if (TREE_CODE (val) != INTEGER_CST)
{
tree cval;
rtx val_rtx;
cval = fold_build1 (CONVERT_EXPR, unsigned_char_type_node, val);
val_rtx = expand_normal (cval);
val_rtx = expand_normal (val);
val_rtx = convert_to_mode (TYPE_MODE (unsigned_char_type_node),
val_rtx, 0);
/* Assume that we can memset by pieces if we can store the
* the coefficients by pieces (in the required modes).

View file

@ -1,3 +1,8 @@
2006-04-28 Jakub Jelinek <jakub@redhat.com>
PR middle-end/27260
* gcc.c-torture/execute/pr27260.c: New.
2006-04-28 Alan Modra <amodra@bigpond.net.au>
PR middle-end/27095

View file

@ -0,0 +1,33 @@
/* PR middle-end/27260 */
extern void abort (void);
extern void *memset (void *, int, __SIZE_TYPE__);
char buf[65];
void
foo (int x)
{
memset (buf, x != 2 ? 1 : 0, 64);
}
int
main (void)
{
int i;
buf[64] = 2;
for (i = 0; i < 64; i++)
if (buf[i] != 0)
abort ();
foo (0);
for (i = 0; i < 64; i++)
if (buf[i] != 1)
abort ();
foo (2);
for (i = 0; i < 64; i++)
if (buf[i] != 0)
abort ();
if (buf[64] != 2)
abort ();
return 0;
}