[LLVMbugs] [Bug 11748] New: Return from new not assumed to be non-null
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed Jan 11 18:53:24 PST 2012
http://llvm.org/bugs/show_bug.cgi?id=11748
Bug #: 11748
Summary: Return from new not assumed to be non-null
Product: libraries
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Scalar Optimizations
AssignedTo: unassignedbugs at nondot.org
ReportedBy: rafael.espindola at gmail.com
CC: jmuizelaar at mozilla.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
Jeff noticed this one.
We compile
void f(int *);
void g() {
int *a = new int;
f(a);
delete a;
}
to
define void @_Z1gv() uwtable optsize {
entry:
%call = tail call noalias i8* @_Znwm(i64 4) optsize
%0 = bitcast i8* %call to i32*
tail call void @_Z1fPi(i32* %0) optsize
%isnull = icmp eq i8* %call, null
br i1 %isnull, label %delete.end, label %delete.notnull
delete.notnull:
tail call void @_ZdlPv(i8* %call) nounwind optsize
br label %delete.end
delete.end:
ret void
}
gcc produces
_Z1gv:
pushq %rbx
movl $4, %edi
call _Znwm
movq %rax, %rbx
movq %rax, %rdi
call _Z1fPi
movq %rbx, %rdi
popq %rbx
jmp _ZdlPv
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list