[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


             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;
  delete a;


define void @_Z1gv() uwtable optsize {
  %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

  tail call void @_ZdlPv(i8* %call) nounwind optsize
  br label %delete.end

  ret void

gcc produces

    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