1 /* Test non-duplication of tlscall insn */
2 
3 /* { dg-do assemble } */
4 /* { dg-options "-O2 -fPIC -mtls-dialect=gnu2" } */
5 
6 typedef struct _IO_FILE FILE;
7 
8 extern int foo(void);
9 extern int bar(void);
10 
uuid__generate_time()11 void uuid__generate_time()
12 {
13  static int has_init = 0;
14  static __thread int state_fd = -2;
15  static __thread FILE *state_f;
16 
17  if (!has_init) {
18    foo();
19    has_init = 1;
20  }
21 
22  if (state_fd == -2) {
23   if (!state_f) {
24    state_fd = -1;
25   }
26  }
27  if (state_fd >= 0) {
28   while (bar() < 0) {}
29  }
30 
31 }
32