builtin-has-attribute-4.c: Skip on 32-bit hppa*-*-hpux*.
[official-gcc.git] / gcc / testsuite / gcc.dg / initpri1.c
blobb6afd7690de5e7306c1138f0fdc7d87e98a1bc18
1 /* { dg-do run { target init_priority } } */
3 extern void abort (void);
5 int i;
6 int j;
8 void c1() __attribute__((constructor (500)));
9 void c2() __attribute__((constructor (700)));
10 void c3() __attribute__((constructor (600)));
12 void c1() {
13 if (i++ != 0)
14 abort ();
17 void c2() {
18 if (i++ != 2)
19 abort ();
22 void c3() {
23 if (i++ != 1)
24 abort ();
27 void d1() __attribute__((destructor (500)));
28 void d2() __attribute__((destructor (700)));
29 void d3() __attribute__((destructor (600)));
31 void d1() {
32 if (--i != 0)
33 abort ();
36 void d2() {
37 if (--i != 2)
38 abort ();
41 void d3() {
42 if (j != 2)
43 abort ();
44 if (--i != 1)
45 abort ();
48 void cd4() __attribute__((constructor (800), destructor (800)));
50 void cd4() {
51 if (i != 3)
52 abort ();
53 ++j;
56 int main () {
57 if (i != 3)
58 return 1;
59 if (j != 1)
60 abort ();
61 return 0;