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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@113341
138bc75d-0d04-0410-961f-
82ee72b054a4
+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
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).
+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
--- /dev/null
+/* 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;
+}