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
This commit is contained in:
parent
d5fabb5835
commit
de77ab7591
4 changed files with 57 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
44
gcc/testsuite/gcc.target/i386/pr46647.c
Normal file
44
gcc/testsuite/gcc.target/i386/pr46647.c
Normal file
|
@ -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" } } */
|
Loading…
Add table
Reference in a new issue