<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 --- - Compiler crash with -fprofile-instr-use at -O0"
   href="https://llvm.org/bugs/show_bug.cgi?id=31209">31209</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Compiler crash with -fprofile-instr-use at -O0
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Linux
          </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>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>rob.lougher@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=17686" name="attach_17686" title="crashdump">attachment 17686</a> <a href="attachment.cgi?id=17686&action=edit" title="crashdump">[details]</a></span>
crashdump

$ clang --version
clang version 4.0.0 (trunk 288143)

Reduced test-case:

$ cat foo.cpp
void fn1(void) __attribute__((__noreturn__));
void foo(void) {fn1(); }

Text-based IR profile:

$ cat profile.txt
# IR level Instrumentation Flag
:ir
_Z3foov
# Func Hash:
12884901887
# Num Counters:
1
# Counter Values:
0

Steps to reproduce crash:

$ llvm-profdata merge profile.txt --output=out.profdata
$ clang foo.cpp -O0 -c -fprofile-instr-use=out.profdata

#0 0x000000000367cfc7 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/llvm/lib/Support/Unix/Signals.inc:402:0
...

(crash dump attached)

The crash does not occur at -O1 or -O2.</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>