URL
https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk
Go to most recent revision |
Only display areas with differences |
Details |
Blame |
View Log
Rev 298 |
Rev 384 |
/* PR middle-end/11151 */
|
/* PR middle-end/11151 */
|
/* Originator: Andrew Church <gcczilla@achurch.org> */
|
/* Originator: Andrew Church <gcczilla@achurch.org> */
|
/* { dg-do run } */
|
/* { dg-do run } */
|
/* { dg-xfail-run-if "PR36571 untyped return is char register" { "avr-*-*" } { "*" } { "" } } */
|
/* { dg-xfail-run-if "PR36571 untyped return is char register" { "avr-*-*" } { "*" } { "" } } */
|
/* This used to fail on SPARC because the (undefined) return
|
/* This used to fail on SPARC because the (undefined) return
|
value of 'bar' was overwriting that of 'foo'. */
|
value of 'bar' was overwriting that of 'foo'. */
|
|
|
extern void abort(void);
|
extern void abort(void);
|
|
|
int foo(int n)
|
int foo(int n)
|
{
|
{
|
return n+1;
|
return n+1;
|
}
|
}
|
|
|
int bar(int n)
|
int bar(int n)
|
{
|
{
|
__builtin_return(__builtin_apply((void (*)(void))foo, __builtin_apply_args(), 64));
|
__builtin_return(__builtin_apply((void (*)(void))foo, __builtin_apply_args(), 64));
|
}
|
}
|
|
|
char *g;
|
char *g;
|
|
|
int main(void)
|
int main(void)
|
{
|
{
|
/* Allocate 64 bytes on the stack to make sure that __builtin_apply
|
/* Allocate 64 bytes on the stack to make sure that __builtin_apply
|
can read at least 64 bytes above the return address. */
|
can read at least 64 bytes above the return address. */
|
char dummy[64];
|
char dummy[64];
|
|
|
g = dummy;
|
g = dummy;
|
|
|
if (bar(1) != 2)
|
if (bar(1) != 2)
|
abort();
|
abort();
|
|
|
return 0;
|
return 0;
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.