Check int_size_in_bytes in ix86_return_in_memory

ix86_return_in_memory should check negative return from int_size_in_bytes,
similar to other ports.

gcc/

	PR target/66817
	* config/i386/i386.c (ix86_return_in_memory): Return true
	if int_size_in_bytes returns negative for IA MCU.

gcc/testsuite/

	PR target/66817
	* gcc.target/i386/pr66817.c: New test.

From-SVN: r225605
This commit is contained in:
H.J. Lu 2015-07-09 09:26:47 +00:00 committed by H.J. Lu
parent ca87c493f7
commit 661c8707bf
4 changed files with 39 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2015-07-09 H.J. Lu <hongjiu.lu@intel.com>
PR target/66817
* config/i386/i386.c (ix86_return_in_memory): Return true
if int_size_in_bytes returns negative for IA MCU.
2015-07-09 Marek Polacek <polacek@redhat.com>
PR tree-optimization/66718

View File

@ -8682,7 +8682,7 @@ ix86_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
/* Intel MCU psABI returns scalars and aggregates no larger than 8
bytes in registers. */
if (TARGET_IAMCU)
return VECTOR_MODE_P (mode) || size > 8;
return VECTOR_MODE_P (mode) || size < 0 || size > 8;
if (mode == BLKmode)
return true;

View File

@ -1,3 +1,8 @@
2015-07-09 H.J. Lu <hongjiu.lu@intel.com>
PR target/66817
* gcc.target/i386/pr66817.c: New test.
2015-07-09 Marek Polacek <polacek@redhat.com>
PR tree-optimization/66718

View File

@ -0,0 +1,27 @@
/* { dg-do compile { target ia32 } } */
/* { dg-options "-O2 -mno-sse -mno-mmx -miamcu" } */
extern void abort (void);
int
main (int argc, char **argv)
{
int size = 10;
typedef struct
{
char val[size];
}
block;
block a, b;
block __attribute__((noinline))
retframe_block ()
{
return *(block *) &b;
}
b.val[0] = 1;
b.val[9] = 2;
a=retframe_block ();
if (a.val[0] != 1
|| a.val[9] != 2)
abort ();
return 0;
}