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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [constructor-1.c] - Blame information for rev 689

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 jeremybenn
/* { dg-do run } */
2
/* { dg-options "-O2" } */
3
 
4
/* The ipa-split pass pulls the body of the if(!x) block
5
   into a separate function to make foo a better inlining
6
   candidate.  Make sure this new function isn't also run
7
   as a static constructor.  */
8
 
9
#include <stdlib.h>
10
 
11
int x, y;
12
 
13
void __attribute__((noinline))
14
bar(void)
15
{
16
  y++;
17
}
18
 
19
void __attribute__((constructor))
20
foo(void)
21
{
22
  if (!x)
23
    {
24
      bar();
25
      y++;
26
    }
27
}
28
 
29
int main()
30
{
31
  x = 1;
32
  foo();
33
  foo();
34
  if (y != 2)
35
    abort();
36
  exit(0);
37
}

powered by: WebSVN 2.1.0

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