https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82803

--- Comment #10 from Yann Droneaud <yann at droneaud dot fr> ---
Some more snippets, generated with creduce:

-----------------8<--------------------
  void a(long *);
  int b(void);
  void c(void);
  long d(void) {
    static __thread long e;
    a(&e);
    if (b())
      c();
    return e;
  }
------------------8<--------------------
  int a(void);
  void b(long *);
  void c(void) {
    static __thread long d;
    if (d || a())
      d = 0;
    b(&d);
  }
------------------8<--------------------
  void a(int *);
  int b(int *);
  int c(void) {
    static __thread int d;
    a(&d);
    while (b(&d));
    return 0;
  }
------------------8<--------------------
  void b(int *);
  int c(int *);
  int d(void) {
    static __thread int a;
    if (a)
      while (c(&a));
    b(&a);
    return 0;
  }
------------------8<--------------------
  int b(void);
  void c(void);
  void d(int *);
  int e(void) {
    static __thread int a[2];
    d(a);
    do {
      d(a);
      if (b())
        c();
    } while (a[0] && a[1]);
    d(a);
    return 0;
  }
------------------8<--------------------

Those make gcc emits 2 or more calls to __tls_get_addr().

Reply via email to