Commit de77ab75 by H.J. Lu Committed by H.J. Lu

Properly cast integer constant char.

gcc/

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.

gcc/testsuite/

2010-11-25  H.J. Lu  <hongjiu.lu@intel.com>

	PR middle-end/46647
	* gcc.target/i386/pr46647.c: New.

From-SVN: r167146
parent d5fabb58
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> 2010-11-25 Joseph Myers <joseph@codesourcery.com>
* target.def (supports_split_stack, except_unwind_info): Take * target.def (supports_split_stack, except_unwind_info): Take
...@@ -630,11 +630,11 @@ target_char_cast (tree cst, char *p) ...@@ -630,11 +630,11 @@ target_char_cast (tree cst, char *p)
{ {
unsigned HOST_WIDE_INT val, hostval; 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) || CHAR_TYPE_SIZE > HOST_BITS_PER_WIDE_INT)
return 1; return 1;
val = tree_low_cst (cst, 1); val = TREE_INT_CST_LOW (cst);
if (CHAR_TYPE_SIZE < HOST_BITS_PER_WIDE_INT) if (CHAR_TYPE_SIZE < HOST_BITS_PER_WIDE_INT)
val &= (((unsigned HOST_WIDE_INT) 1) << CHAR_TYPE_SIZE) - 1; val &= (((unsigned HOST_WIDE_INT) 1) << CHAR_TYPE_SIZE) - 1;
......
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> 2010-11-25 Kai Tietz <kai.tietz@onevision.com>
* gcc.dg/dll-8.c: New. * gcc.dg/dll-8.c: New.
......
/* { 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" } } */
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