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

--- Comment #78 from LIU Hao <lh_mouse at 126 dot com> ---
I changed it to `ix86_GOT_alias_set()` and checked output assembly. The patch
should be fine for these setups:

  * x86_64-w64-mingw-32 (-O0, -O1, -O2, -Os)
  * i686-w64-mingw-32 (-O0, -O1, -O2, -Os)

Simple test program:

```
#include <assert.h>

struct Data
  {
    int value;
    Data() { value = 42; }
    ~Data() { }
  };

thread_local Data ecx;
thread_local Data esp;

int
accumulate(int r)
  {
    int t = ecx.value;
    ecx.value += r;
    t += esp.value;
    esp.value ++;
    return t;
  }

int
main(void)
  {
    assert(ecx.value == 42);
    assert(esp.value == 42);

    assert(accumulate(10) == 42 + 42);
    assert(accumulate(11) == 52 + 43);
    assert(accumulate(12) == 63 + 44);
  }

```

Reply via email to