<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 --- - Clang-4.0 crashes/assert while evaluating __builtin_object_size: "APValues can't handle invalid LValue bases""
href="https://llvm.org/bugs/show_bug.cgi?id=31843">31843</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Clang-4.0 crashes/assert while evaluating __builtin_object_size: "APValues can't handle invalid LValue bases"
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>4.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</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>mehdi.amini@apple.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>Simple reproduction (build as C file):
struct statfs { char f_mntonname[1024];};
fn1() {
struct statfs *outStatFSBuf;
__builtin_object_size (outStatFSBuf->f_mntonname ? outStatFSBuf : "", 2 > 1 ?
1 : 0);
}
AFAICT what happens is that in:
static bool Evaluate(APValue &Result, EvalInfo &Info, const Expr *E) {
we're doing:
} else if (T->hasPointerRepresentation()) {
LValue LV;
if (!EvaluatePointer(E, LV, Info))
return false;
LV.moveInto(Result);
The issue is that `Info.allowInvalidBaseExpr()` is true, so `EvaluatePointer`
returns true even though the Base is marked as invalid in the result `LV`.
We then assert in the call `LV.moveInto(Result);` "APValues can't handle
invalid LValue bases"</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>