<html>
<head>
<base href="http://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 should throw away unused assignment before operator delete"
href="http://llvm.org/bugs/show_bug.cgi?id=17727">17727</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>clang should throw away unused assignment before operator delete
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.3
</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>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>yozh@mx1.ru
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Code:
===
void foo(int* x) {
x[0] = 54321;
delete[] x;
}
===
When compiled with clang++ -O3 -c -S -emit-llvm, produces bitcode:
===
define void @_Z3fooPi(i32* %x) #0 {
store i32 54321, i32* %x, align 4, !tbaa !0
%1 = icmp eq i32* %x, null
br i1 %1, label %4, label %2
; <label>:2 ; preds = %0
%3 = bitcast i32* %x to i8*
tail call void @_ZdaPv(i8* %3) #2
br label %4
; <label>:4 ; preds = %2, %0
ret void
}
===
`store i32 54321 ...` can be thrown away. clang already does it if `free`
function is used instead of operator delete.</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>