aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.4.3/gcc/testsuite/gcc.target/i386/pr38988.c
blob: 8e2c8eaa67b88d3dd9f934fe503e85390f8368c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* { dg-do compile } */
/* { dg-require-effective-target lp64 } */
/* { dg-require-effective-target fpic } */
/* { dg-options "-O2 -fpic -mcmodel=large" } */

typedef long unsigned int size_t;
typedef void (*func_ptr) (void);

static func_ptr __DTOR_LIST__[1] = { (func_ptr) (-1) };

void
__do_global_dtors_aux (void)
{
  extern func_ptr __DTOR_END__[];
  size_t dtor_idx = 0;
  const size_t max_idx = __DTOR_END__ - __DTOR_LIST__ - 1;
  func_ptr f;

  while (dtor_idx < max_idx)
    {
      f = __DTOR_LIST__[++dtor_idx];
      f ();
    }
}