<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><span class="vcard"><a class="email" href="mailto:george.burgess.iv@gmail.com" title="George Burgess <george.burgess.iv@gmail.com>"> <span class="fn">George Burgess</span></a>
</span> changed
<a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED WONTFIX - @llvm.objectsize treats allocsize differently than allocas."
href="https://llvm.org/bugs/show_bug.cgi?id=28834">bug 28834</a>
<br>
<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>What</th>
<th>Removed</th>
<th>Added</th>
</tr>
<tr>
<td style="text-align:right;">Status</td>
<td>ASSIGNED
</td>
<td>RESOLVED
</td>
</tr>
<tr>
<td style="text-align:right;">Resolution</td>
<td>---
</td>
<td>WONTFIX
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED WONTFIX - @llvm.objectsize treats allocsize differently than allocas."
href="https://llvm.org/bugs/show_bug.cgi?id=28834#c1">Comment # 1</a>
on <a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED WONTFIX - @llvm.objectsize treats allocsize differently than allocas."
href="https://llvm.org/bugs/show_bug.cgi?id=28834">bug 28834</a>
from <span class="vcard"><a class="email" href="mailto:george.burgess.iv@gmail.com" title="George Burgess <george.burgess.iv@gmail.com>"> <span class="fn">George Burgess</span></a>
</span></b>
<pre>So, this is a kind-of dup of PR23301. Moreover, if we actually use `p` and `v`
in the initial repro (so InstCombine doesn't remove them before inlining
happens), we get accurate results for `objectsize`.
The most straightforward way to fix this seems to be "keep the unused
malloc/new/whatever calls around until we *can* get accurate results." I'm not
entirely thrilled with that idea, mostly because I can't think of a real-world
use for a best-effort objectsize of an unused allocation.
Note that the following variant of the repro *does* give us accurate results:
```
void *malloc2(int n) __attribute((alloc_size(1)));
void allocsize(void *p, void *v) {
g0 = __builtin_object_size(p, 0);
g1 = __builtin_object_size(v, 1);
}
void allocsize1() {
allocsize(malloc2(5), malloc2(8));
}
```
So, I'm marking this WONTFIX. I'm happy to revisit this if someone believes
that giving more accurate results in this case would be useful.</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>