Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/gcc.c-torture/compile/20190827-1.c @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
131:84e7813d76e9 | 145:1830386684a0 |
---|---|
1 /* { dg-require-alias "" } */ | |
2 typedef unsigned char __u8; | |
3 typedef __u8 u8; | |
4 typedef u8 u_int8_t; | |
5 typedef unsigned int gfp_t; | |
6 | |
7 struct list_head | |
8 { | |
9 struct list_head *next, *prev; | |
10 }; | |
11 extern int strcmp (const char *, const char *); | |
12 enum | |
13 { | |
14 NFPROTO_UNSPEC = 0, | |
15 NFPROTO_INET = 1, | |
16 NFPROTO_IPV4 = 2, | |
17 NFPROTO_ARP = 3, | |
18 NFPROTO_NETDEV = 5, | |
19 NFPROTO_BRIDGE = 7, | |
20 NFPROTO_IPV6 = 10, | |
21 NFPROTO_DECNET = 12, | |
22 NFPROTO_NUMPROTO, | |
23 }; | |
24 | |
25 struct xt_target | |
26 { | |
27 struct list_head list; | |
28 const char name[29]; | |
29 u_int8_t revision; | |
30 }; | |
31 | |
32 struct xt_af | |
33 { | |
34 struct list_head target; | |
35 }; | |
36 | |
37 static struct xt_af *xt; | |
38 | |
39 struct xt_af * kcalloc (int, int, int); | |
40 | |
41 static int | |
42 target_revfn (u8 af, const char *name, u8 revision, int *bestp) | |
43 { | |
44 const struct xt_target *t; | |
45 int have_rev = 0; | |
46 | |
47 for (t = ( | |
48 { | |
49 void *__mptr = (void *)((&xt[af].target)->next); | |
50 ((typeof (*t) *) (__mptr - | |
51 __builtin_offsetof (typeof (*t), list)));} | |
52 ); &t->list != (&xt[af].target); t = ( | |
53 { | |
54 void *__mptr = | |
55 (void *)((t)->list.next); | |
56 ((typeof (*(t)) *) (__mptr - | |
57 __builtin_offsetof | |
58 (typeof | |
59 (*(t)), | |
60 list)));} | |
61 )) | |
62 { | |
63 if (strcmp (t->name, name) == 0) | |
64 { | |
65 if (t->revision > *bestp) | |
66 *bestp = t->revision; | |
67 if (t->revision == revision) | |
68 have_rev = 1; | |
69 } | |
70 } | |
71 | |
72 if (af != NFPROTO_UNSPEC && !have_rev) | |
73 return target_revfn (NFPROTO_UNSPEC, name, revision, bestp); | |
74 | |
75 return have_rev; | |
76 } | |
77 | |
78 int | |
79 xt_find_revision (u8 af, const char *name, u8 revision, int target, int *err) | |
80 { | |
81 int have_rev, best = -1; | |
82 | |
83 have_rev = target_revfn (af, name, revision, &best); | |
84 | |
85 | |
86 if (best == -1) | |
87 { | |
88 *err = -2; | |
89 return 0; | |
90 } | |
91 | |
92 } | |
93 | |
94 | |
95 static int __attribute__ ((__section__ (".init.text"))) | |
96 __attribute__ ((__cold__)) xt_init (void) | |
97 { | |
98 xt = | |
99 kcalloc (NFPROTO_NUMPROTO, sizeof (struct xt_af), | |
100 (((gfp_t) (0x400u | 0x800u)) | ((gfp_t) 0x40u) | | |
101 ((gfp_t) 0x80u))); | |
102 } | |
103 | |
104 int init_module (void) __attribute__ ((__copy__ (xt_init))) | |
105 __attribute__ ((alias ("xt_init")));; |