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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [initpri3.c] - Blame information for rev 708

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 jeremybenn
/* { dg-do run { target init_priority } } */
2
/* { dg-require-effective-target lto } */
3
/* { dg-options "-flto -O3" } */
4
 
5
extern void abort ();
6
 
7
int i;
8
int j;
9
 
10
void c1() __attribute__((constructor (500)));
11
void c2() __attribute__((constructor (700)));
12
void c3() __attribute__((constructor (600)));
13
 
14
void c1() {
15
  if (i++ != 0)
16
    abort ();
17
}
18
 
19
void c2() {
20
  if (i++ != 2)
21
    abort ();
22
}
23
 
24
void c3() {
25
  if (i++ != 1)
26
    abort ();
27
}
28
 
29
void d1() __attribute__((destructor (500)));
30
void d2() __attribute__((destructor (700)));
31
void d3() __attribute__((destructor (600)));
32
 
33
void d1() {
34
  if (--i != 0)
35
    abort ();
36
}
37
 
38
void d2() {
39
  if (--i != 2)
40
    abort ();
41
}
42
 
43
void d3() {
44
  if (j != 2)
45
    abort ();
46
  if (--i != 1)
47
    abort ();
48
}
49
 
50
void cd4() __attribute__((constructor (800), destructor (800)));
51
 
52
void cd4() {
53
  if (i != 3)
54
    abort ();
55
  ++j;
56
}
57
 
58
int main () {
59
  if (i != 3)
60
    return 1;
61
  if (j != 1)
62
    abort ();
63
  return 0;
64
}

powered by: WebSVN 2.1.0

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