<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/60382>60382</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Clang on Windows didn't initialize __thread variable
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          YWtheGod
      </td>
    </tr>
</table>

<pre>
    test program test.c :
`#include <stdio.h>
static __thread int a = 100;
int main()
{
 printf("Hello, World!\n");
    printf("%d\n",a);
    return 0;
}`
compiled with
`clang -target x86_64-w64-windows-gnu test.c -o test_gnu.exe`
compile and link successfully, but test_gnu.exe hung when accessing variable a since a didn't get initialized

compiled with
`clang -target -target x86_64-pc-windows-msvc test.c -o test_msvc.exe`
test_msvc.exe run successfully, value of a get printed.

compiled and run with gcc without any problem.

same llvm source build in linux can run same test program without any problem.
[test.zip](https://github.com/llvm/llvm-project/files/10534899/test.zip)

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVE2PmzAU_DXm8hTkGAhw4LCbNO0_WPUUGfsF3Bo78keyu7--MvlS0qpqD8jGnjfMPMbm3qvBIHakeiXVJuMxjNZ139_CiF-tzHorP7qAPsDB2cHxCdJLLoAUL4RuCH0hK0pYoYzQUSKQYu2DVDYfSfHlDPCBByVgtwujQy5BmQAcSLGBJaWkeD2j0urElSGsIay9UNeXTTg4ZcJ-3mPfUGtL2BrerNOSsCWp1oYwlsqubADwUENYJW-wNX-GOgzRGbirIfUm-Zrnwk4HpVHCSYXx5llobgZYBO4GDPDerHarcnFKjzLSnvxiMPHaq4WdZ7vBxBzf8ZkZuJGglfkJPgqB3u-j1h_JYR_DQyWM0QxwGtEAn5HKDHDkTvE-0YBXRqRRKmkIqwMkbcqooLhWnygv6v_Z1pO9g7i5m_xRPNtLaw_-HlbBRfObwSPXEcHugc9S51-GMv-jztSlxJH0wiDEPLExADcfKZ29xumh0vMJQevjBN5GJxD6qHTKX2p2fAfBzVlUwj1k_C_M1evs-lMdSLUhrBlDOPh0GNiWsO2gwhj7XNiJsG369GVYHJz9gSIQtt0rjZ6w7ZJWRdm0LWHbG-M1-JnsCtkWLc-wW67qitZVScts7HqsJZZs39OGNi2WNd1jL9qmb_cFK_s-Ux2jrKDLgi5pWbAy502BDFd9LUVTi7YiJcWJK50nWbl1Q6a8j9itaNGwTPMetZ8vA8YMnmDeTKem2mSum630cfCkpFr54O8sQQWN3XqOjzXwds7JPYn3FN5vgmtys-h099-NnKWlTs7SfwUAAP__mYSGgg">