<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW " title="NEW --- - [ms] clang-cl miscompiles std::atomic_flag" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D24101&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=T85dIeYrB9wTgWx_kQOBVe-72psGte7KFTa0Bo4kcTo&s=zU5hMC_Q-ORl_7Noqxhiz4pJTbe3WHjQldalEJ8X9lo&e=">24101</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[ms] clang-cl miscompiles std::atomic_flag
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Frontend
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>nicolasweber@gmx.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>C:\src\chromefetch\src\third_party\llvm-build\Release+Asserts>type test.cc
#include <atomic>
#include <map>

int main(int argc, char* argv[]) {
  std::map<const char*, std::atomic_flag> Seen;

  for (int i = 1; i < argc; ++i)
    Seen[argv[i]].clear();

  for (int i = 1; i < argc; ++i)
    if (Seen[argv[i]].test_and_set())
      fprintf(stderr, "waaaaat\n");
}

C:\src\chromefetch\src\third_party\llvm-build\Release+Asserts>cl /O2 test.cc
/EHsc
Microsoft (R) C/C++ Optimizing Compiler Version 18.00.31101 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

test.cc
Microsoft (R) Incremental Linker Version 12.00.31101.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:test.exe
test.obj

C:\src\chromefetch\src\third_party\llvm-build\Release+Asserts>test a b c

C:\src\chromefetch\src\third_party\llvm-build\Release+Asserts>bin\clang-cl /O2
test.cc

C:\src\chromefetch\src\third_party\llvm-build\Release+Asserts>test a b c
waaaaat
waaaaat



(Reduced from code in the new COFF lld)</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>