2015-09-24 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / gcc.dg / torture / pr51071-2.c
blobccf3d815872c9bbeeaa901bba7c33076cc659c0e
1 /* { dg-do compile } */
2 /* { dg-options "-fno-delete-null-pointer-checks" } */
4 __extension__ typedef __UINTPTR_TYPE__ uintptr_t;
6 extern struct module __this_module;
7 static inline void
8 trace_module_get (struct module *mod, uintptr_t ip) { }
9 struct module;
10 int module_is_live (struct module *);
11 static inline __attribute__((no_instrument_function))
12 int try_module_get(struct module *module)
14 int ret = 1;
15 if (module)
17 if (module_is_live(module))
19 __label__ __here;
20 asm("");
21 __here:
22 trace_module_get(module, (uintptr_t)&&__here);
24 else
25 ret = 0;
27 return ret;
29 struct net_device;
30 struct net_device_ops {
31 int (*ndo_open)(struct net_device *dev);
33 int hdlc_open (struct net_device *);
34 int t3e3_open(struct net_device *dev)
36 int ret = hdlc_open(dev);
37 if (ret)
38 return ret;
39 try_module_get((&__this_module));
40 return 0;
42 const struct net_device_ops t3e3_ops = { .ndo_open = t3e3_open };