1 /* { dg-do run } */
2 /* { dg-additional-sources "pr53272-2.c" } */
3 struct rtc_class_ops {
4  int (*f)(void *, unsigned int enabled);
5 };
6 
7 struct rtc_device
8 {
9  void *owner;
10  const struct rtc_class_ops *ops;
11  int ops_lock;
12 };
13 
14 __attribute__ ((__noinline__, __noclone__))
15 extern int foo(void *);
16 __attribute__ ((__noinline__, __noclone__))
17 extern void foobar(void *);
18 
19 __attribute__ ((__noinline__, __noclone__))
rtc_update_irq_enable(struct rtc_device * rtc,unsigned int enabled)20 int rtc_update_irq_enable(struct rtc_device *rtc, unsigned int enabled)
21 {
22  int err;
23  asm volatile ("");
24 
25  err = foo(&rtc->ops_lock);
26 
27  if (err)
28   return err;
29 
30  if (!rtc->ops)
31   err = -19;
32  else if (!rtc->ops->f)
33   err = -22;
34  else
35   err = rtc->ops->f(rtc->owner, enabled);
36 
37  foobar(&rtc->ops_lock);
38  return err;
39 }
40