For Ian Bolton <ian.bolton@arm.com>

2010-08-19  Ian Bolton  <ian.bolton@arm.com>

	PR target/45070
	* gcc.c-torture/execute/pr45070.c: New.
	* config/arm/arm.c (arm_output_epilogue): Ensure that return
	 value of size 1-3 is handled correctly.

From-SVN: r163367
This commit is contained in:
Ian Bolton 2010-08-19 08:27:59 +00:00 committed by Ramana Radhakrishnan
parent f096c02afc
commit c92f1823b0
4 changed files with 65 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2010-08-19 Ian Bolton <ian.bolton@arm.com>
PR target/45070
* config/arm/arm.c (arm_output_epilogue): Ensure that return
value of size 1-3 is handled correctly.
2010-08-19 Ian Bolton <ian.bolton@arm.com>
* tree-switch-conversion.c (gen_inbound_check): Ensure that the

View File

@ -14467,7 +14467,8 @@ arm_output_epilogue (rtx sibling)
&& !crtl->tail_call_emit)
{
unsigned long mask;
mask = (1 << (arm_size_return_regs() / 4)) - 1;
/* Preserve return values, of any size. */
mask = (1 << ((arm_size_return_regs() + 3) / 4)) - 1;
mask ^= 0xf;
mask &= ~saved_regs_mask;
reg = 0;

View File

@ -1,3 +1,8 @@
2010-08-19 Ian Bolton <ian.bolton@arm.com>
PR target/45070
* gcc.c-torture/execute/pr45070.c: New.
2010-08-19 Ian Bolton <ian.bolton@arm.com>
* g++.dg/pr44328.C: New test.

View File

@ -0,0 +1,52 @@
/* PR45070 */
extern void abort(void);
struct packed_ushort {
unsigned short ucs;
} __attribute__((packed));
struct source {
int pos, length;
int flag;
};
static void __attribute__((noinline)) fetch(struct source *p)
{
p->length = 128;
}
static struct packed_ushort __attribute__((noinline)) next(struct source *p)
{
struct packed_ushort rv;
if (p->pos >= p->length) {
if (p->flag) {
p->flag = 0;
fetch(p);
return next(p);
}
p->flag = 1;
rv.ucs = 0xffff;
return rv;
}
rv.ucs = 0;
return rv;
}
int main(void)
{
struct source s;
int i;
s.pos = 0;
s.length = 0;
s.flag = 0;
for (i = 0; i < 16; i++) {
struct packed_ushort rv = next(&s);
if ((i == 0 && rv.ucs != 0xffff)
|| (i > 0 && rv.ucs != 0))
abort();
}
return 0;
}