1/* { dg-do compile } */
2/* { dg-require-effective-target lp64 } */
3/* { dg-require-effective-target fpic } */
4/* { dg-options "-O2 -fpic -mcmodel=large" } */
5
6typedef long unsigned int size_t;
7typedef void (*func_ptr) (void);
8
9static func_ptr __DTOR_LIST__[1] = { (func_ptr) (-1) };
10
11void
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}
25