8449cc69cfdbf41c1a97489ec6883a7d97dc9001
[platform/upstream/gcc48.git] / gcc / testsuite / gcc.target / i386 / pr38988.c
1 /* { dg-do compile } */
2 /* { dg-require-effective-target lp64 } */
3 /* { dg-require-effective-target fpic } */
4 /* { dg-options "-O2 -fpic -mcmodel=large" } */
5
6 __extension__ typedef __SIZE_TYPE__ size_t;
7 typedef void (*func_ptr) (void);
8
9 static func_ptr __DTOR_LIST__[1] = { (func_ptr) (-1) };
10
11 void
12 __do_global_dtors_aux (void)
13 {
14   extern func_ptr __DTOR_END__[];
15   size_t dtor_idx = 0;
16   const size_t max_idx = __DTOR_END__ - __DTOR_LIST__ - 1;
17   func_ptr f;
18
19   while (dtor_idx < max_idx)
20     {
21       f = __DTOR_LIST__[++dtor_idx];
22       f ();
23     }
24 }