annotate gcc/testsuite/gcc.dg/pr45506.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* { dg-do compile } */
kono
parents:
diff changeset
2 /* { dg-require-effective-target ilp32 } */
kono
parents:
diff changeset
3 /* { dg-options "-g -O -w" } */
kono
parents:
diff changeset
4
kono
parents:
diff changeset
5 typedef unsigned _GCC_ATTR_ALIGN_u32t;
kono
parents:
diff changeset
6 typedef _GCC_ATTR_ALIGN_u32t _Uint32t __attribute__((__aligned__(4)));
kono
parents:
diff changeset
7 typedef int _Intptrt __attribute__((__mode__(__pointer__)));
kono
parents:
diff changeset
8 typedef unsigned int _Uintptrt __attribute__((__mode__(__pointer__)));
kono
parents:
diff changeset
9 typedef _Intptrt ptrdiff_t;
kono
parents:
diff changeset
10 typedef _Uintptrt uintptr_t;
kono
parents:
diff changeset
11 typedef _Uint32t Elf32_Word;
kono
parents:
diff changeset
12 typedef struct list_head list_head_t;
kono
parents:
diff changeset
13
kono
parents:
diff changeset
14 struct list_head {
kono
parents:
diff changeset
15 list_head_t *next;
kono
parents:
diff changeset
16 };
kono
parents:
diff changeset
17
kono
parents:
diff changeset
18 struct object { };
kono
parents:
diff changeset
19
kono
parents:
diff changeset
20 struct objlist {
kono
parents:
diff changeset
21 struct object *object;
kono
parents:
diff changeset
22 };
kono
parents:
diff changeset
23
kono
parents:
diff changeset
24 static uintptr_t ldd(void *frame) __attribute__((__used__));
kono
parents:
diff changeset
25 static list_head_t *_dl_all_objects_ptr;
kono
parents:
diff changeset
26 static void fini_array(struct object *const obj) {
kono
parents:
diff changeset
27 if ((dynvec(obj,(unsigned)26)) != ((Elf32_Word)-1)) {
kono
parents:
diff changeset
28 unsigned i;
kono
parents:
diff changeset
29 const unsigned funcs = (dynvec(obj,(unsigned)28)) / 4;
kono
parents:
diff changeset
30 const Elf32_Word fa = (dynvec(obj,(unsigned)26));
kono
parents:
diff changeset
31 const int *const p = relative_relocp(obj);
kono
parents:
diff changeset
32 for (i = (funcs ? (funcs - 1) : 0U); i != 0U; i--) {
kono
parents:
diff changeset
33 void (*const func)(void) = (void *) p[i];
kono
parents:
diff changeset
34 (*func)();
kono
parents:
diff changeset
35 }
kono
parents:
diff changeset
36 }
kono
parents:
diff changeset
37 }
kono
parents:
diff changeset
38 static void _do_exit_fini(void) {
kono
parents:
diff changeset
39 const struct objlist *o;
kono
parents:
diff changeset
40 for (((o)) = ((void *)(((list_head_t *)(_dl_all_objects_ptr))->next));
kono
parents:
diff changeset
41 !((((o))) == ((void *)((list_head_t *)(_dl_all_objects_ptr))));
kono
parents:
diff changeset
42 ((o)) = ((void *)(((list_head_t *)((o)))->next)))
kono
parents:
diff changeset
43 fini_array (o->object);
kono
parents:
diff changeset
44 }
kono
parents:
diff changeset
45 static uintptr_t ldd (void *frame) {
kono
parents:
diff changeset
46 atexit(_do_exit_fini);
kono
parents:
diff changeset
47 }