<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 - Segfault in llvm::ConstantFoldCompareInstruction due to reaching an llvm_unreachable."
href="https://bugs.llvm.org/show_bug.cgi?id=41476">41476</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Segfault in llvm::ConstantFoldCompareInstruction due to reaching an llvm_unreachable.
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</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>Scalar Optimizations
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>bmoses@google.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=21765" name="attach_21765" title="Reduced testcase">attachment 21765</a> <a href="attachment.cgi?id=21765&action=edit" title="Reduced testcase">[details]</a></span>
Reduced testcase
If we build the attached .cpp file with a version of Clang that's compiled to
warn on reaching unreachable code, and using "-O2" or higher, we get an error
like the following:
Invalid FCmp Predicate
UNREACHABLE executed at llvm/lib/IR/ConstantFold.cpp:1814!
Stack dump:
0. Program arguments: clang -cc1 -emit-obj -O2 b130316147.cpp
1. <eof> parser at end of file
2. Per-module optimization passes
3. Running pass 'CallGraph Pass Manager' on module 'b130316147.cpp'.
4. Running pass 'Early CSE w/ MemorySSA' on function '@_Z8TestBodyv'
(That line number is current as of r355685 -- it's in the implementation of
llvm::ConstantFoldCompareInstruction.)
With a "normal" build, this was just silent and the compiler continued and
produced an object file that was approximately correct.
However, hans's r357067, "Re-commit r355490 "[CodeGen] Omit range checks from
jump tables when lowering switches with unreachable default"" changes the
behavior of this switch statement when it would reach the unreachable case in a
no-asserts build, and now we get a segfault instead.
It would be nice to fix the underlying bug, as this segfault is now blocking
our Google-internal releases, and I don't think rolling back r357067 is likely
to be the right answer.</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>