OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [gcc.dg/] [builtin-return-1.c] - Blame information for rev 338

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* PR middle-end/11151 */
2
/* Originator: Andrew Church <gcczilla@achurch.org> */
3
/* { dg-do run } */
4
/* { dg-xfail-run-if "PR36571 untyped return is char register" { "avr-*-*" } { "*" } { "" } } */
5
/* This used to fail on SPARC because the (undefined) return
6
   value of 'bar' was overwriting that of 'foo'.  */
7
 
8
extern void abort(void);
9
 
10
int foo(int n)
11
{
12
  return n+1;
13
}
14
 
15
int bar(int n)
16
{
17
  __builtin_return(__builtin_apply((void (*)(void))foo, __builtin_apply_args(), 64));
18
}
19
 
20
char *g;
21
 
22
int main(void)
23
{
24
  /* Allocate 64 bytes on the stack to make sure that __builtin_apply
25
     can read at least 64 bytes above the return address.  */
26
  char dummy[64];
27
 
28
  g = dummy;
29
 
30
  if (bar(1) != 2)
31
    abort();
32
 
33
  return 0;
34
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.