<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 - crash at conditional operator with builtins returning void"
href="https://bugs.llvm.org/show_bug.cgi?id=37551">37551</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>crash at conditional operator with builtins returning void
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</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>LLVM Codegen
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>eugvelesevich@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=20329" name="attach_20329" title="run test">attachment 20329</a> <a href="attachment.cgi?id=20329&action=edit" title="run test">[details]</a></span>
run test
Originally clang crashed at inputmethod package from tizen(inputmethod.cpp)
But I reduced it to:
void get(void* g) {
g ? __builtin_prefetch(g, 0, 1) : __builtin_prefetch(g, 0, 1);
}
and found a reason.
In ScalarExprEmitter::VisitAbstractConditionalOperator from CGExprScalar.cpp
phi instruction with void type is created. In case not-builtin function call
LHS or RHS are null and the instruction isn't created. But in case of builtin
functions the LHS is a void type llvm::Value created in
CodeGenFunction::EmitBuiltinExpr from CGBuiltin.cpp.
I think it's necessary to check builtins with void return type and replace
return expressions with null in CodeGenFunction::EmitBuiltinExpr.</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>