1 /* { dg-do compile } */
2 /* { dg-require-effective-target ia32 } */
3 /* { dg-options "-O2 -fpic -fexceptions -fasynchronous-unwind-tables" } */
4 /* { dg-final { scan-assembler "movl\[ \\t\].+, %ebx" } } */
5 extern int foo (int);
6 extern void exit (int __status) __attribute__ ((__nothrow__ )) __attribute__ ((__noreturn__));
7 struct __pthread_cleanup_frame
8 {
9   void (*__cancel_routine) (void *);
10   void *__cancel_arg;
11   int __do_it;
12   int __cancel_type;
13 };
14 extern __inline void
__pthread_cleanup_routine(struct __pthread_cleanup_frame * __frame)15 __pthread_cleanup_routine (struct __pthread_cleanup_frame *__frame)
16 {
17   if (__frame->__do_it)
18     __frame->__cancel_routine (__frame->__cancel_arg);
19 }
20 static int cl_called;
21 
22 static void
cl(void * arg)23 cl (void *arg)
24 {
25   ++cl_called;
26 }
27 
28 
29 void *
tf_usleep(void * arg)30 tf_usleep (void *arg)
31 {
32 
33   do { struct __pthread_cleanup_frame __clframe __attribute__ ((__cleanup__ (__pthread_cleanup_routine))) = { .__cancel_routine = (cl), .__cancel_arg = (
34 																			 ((void *)0)), .__do_it = 1 };;
35 
36     foo (arg == ((void *)0) ? (0x7fffffffL * 2UL + 1UL) : 0);
37 
38     __clframe.__do_it = (0); } while (0);
39 
40   exit (1);
41 }
42