summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/builtins.c4
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.target/i386/pr46647.c44
4 files changed, 57 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8c5473b4f88..57536cd907c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2010-11-25 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR middle-end/46647
+ * builtins.c (target_char_cast): Check INTEGER_CST instead of
+ host_integerp. Replace tree_low_cst with TREE_INT_CST_LOW.
+
2010-11-25 Joseph Myers <joseph@codesourcery.com>
* target.def (supports_split_stack, except_unwind_info): Take
diff --git a/gcc/builtins.c b/gcc/builtins.c
index c9e8e684fc8..a90bf2fb8f5 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -630,11 +630,11 @@ target_char_cast (tree cst, char *p)
{
unsigned HOST_WIDE_INT val, hostval;
- if (!host_integerp (cst, 1)
+ if (TREE_CODE (cst) != INTEGER_CST
|| CHAR_TYPE_SIZE > HOST_BITS_PER_WIDE_INT)
return 1;
- val = tree_low_cst (cst, 1);
+ val = TREE_INT_CST_LOW (cst);
if (CHAR_TYPE_SIZE < HOST_BITS_PER_WIDE_INT)
val &= (((unsigned HOST_WIDE_INT) 1) << CHAR_TYPE_SIZE) - 1;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 4dc1eeee11f..2253a94f0df 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2010-11-25 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR middle-end/46647
+ * gcc.target/i386/pr46647.c: New.
+
2010-11-25 Kai Tietz <kai.tietz@onevision.com>
* gcc.dg/dll-8.c: New.
diff --git a/gcc/testsuite/gcc.target/i386/pr46647.c b/gcc/testsuite/gcc.target/i386/pr46647.c
new file mode 100644
index 00000000000..c7e1542873b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr46647.c
@@ -0,0 +1,44 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mtune=generic" } */
+
+char a[5];
+int
+func1 (void)
+{
+ __builtin_memset (a,-1,sizeof (a));
+ return 0;
+}
+
+int a2[5];
+int
+func2 (void)
+{
+ __builtin_memset (a2,-1,sizeof (a2));
+ return 0;
+}
+
+char a3[5];
+int
+func3 (void)
+{
+ __builtin_memset (a3,0x8fffffff,sizeof (a3));
+ return 0;
+}
+
+char a4[5];
+int
+func4 (void)
+{
+ __builtin_memset (a4,0x8fffff00,sizeof (a4));
+ return 0;
+}
+
+int a5[5];
+int
+func5 (void)
+{
+ __builtin_memset (a5,0x8fffffff,sizeof (a5));
+ return 0;
+}
+
+/* { dg-final { scan-assembler-not "call\[\\t \]*_?memset" } } */