<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - Code coverage crashing on windows"
   href="https://bugs.llvm.org/show_bug.cgi?id=40613">40613</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Code coverage crashing on windows
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>compiler-rt
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>7.0
          </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>profile
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>mariusguggenmos@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=21437" name="attach_21437" title="sample code + binary + crash dump + description">attachment 21437</a> <a href="attachment.cgi?id=21437&action=edit" title="sample code + binary + crash dump + description">[details]</a></span>
sample code + binary + crash dump + description

TLDR: Small sample compiled on windows (clang-cl) with source code coverage
crashes in initializeValueProfRuntimeRecord

Host:
64 bit windows 10, 1803
VM in VirtualBox
AMD Ryzen 1700X
10GB RAM

<span class="quote">>git status</span >
On branch release/7.x
Your branch is up to date with 'origin/release/7.x'

Compiled with MSVC 19.16.27026.1

<span class="quote">> clang-cl --version</span >
clang version 7.1.0
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Program Files\LLVM701\bin

Build simple test program (source and binary attached) with source code
coverage, i.e.
"-fprofile-instr-generate -fcoverage-mapping"
Run it. It crashes in compiler-rt/lib/InstrProfilingValue.c (334)

Crash (also see test.dmp):
332   while (Site) {
333     C++;
334 --> Site = Site->Next;
335   }

Site: 0x959a638761943be0 (invalid memory address)

[0x0]   test!initializeValueProfRuntimeRecord + 0x14d   
[0x1]   test!writeOneValueProfData + 0x15d   
[0x2]   test!writeValueProfData + 0x8b   
[0x3]   test!lprofWriteDataImpl + 0x270   
[0x4]   test!lprofWriteData + 0xbc   
[0x5]   test!writeFile + 0xbd   
[0x6]   test!__llvm_profile_write_file + 0x179   
[0x7]   test!writeFileWithoutReturn + 0x1a   

Note that this is not c++ specific. I originally tested the sample as c code
with the same results.</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>