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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.target/] [s390/] [return-addr2.c] - Blame information for rev 324

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 324 jeremybenn
/* builtin_return_address(n) with n>0 has always been troublesome.  */
2
 
3
/* { dg-do run } */
4
/* { dg-options "-O3 -fno-optimize-sibling-calls -mbackchain" } */
5
 
6
void *addr1;
7
 
8
extern void abort (void);
9
 
10
void * __attribute__((noinline))
11
foo1 ()
12
{
13
  addr1 = __builtin_return_address (2);
14
}
15
 
16
void * __attribute__((noinline))
17
foo2 ()
18
{
19
  foo1 ();
20
}
21
 
22
void * __attribute__((noinline))
23
foo3 ()
24
{
25
  foo2 ();
26
}
27
 
28
void __attribute__((noinline))
29
bar ()
30
{
31
  void *addr2;
32
 
33
  foo3 ();
34
  asm volatile ("basr  %0,0\n\t" : "=d" (addr2));
35
  /* basr is two bytes in length.  */
36
  if (addr2 - addr1 != 2)
37
    abort ();
38
}
39
 
40
int
41
main ()
42
{
43
  bar();
44
  return 0;
45
}

powered by: WebSVN 2.1.0

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