[LLVMbugs] [Bug 14739] New: miscompile of load+store+call with indirect call

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Dec 28 23:06:37 PST 2012


http://llvm.org/bugs/show_bug.cgi?id=14739

             Bug #: 14739
           Summary: miscompile of load+store+call with indirect call
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: nlewycky at google.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


This testcase is reduced from Lua:

  struct X {
    void (*f)();
  };

  void aux_close(X *x) {
    void (*cf)() = x->f;
    x->f = 0;
    (*cf)();
  }

With llc, whether at -O0 or -O2 on x86 we get:

# BB#0:                                 # %entry
    movq    $0, (%rdi)
    jmpq    *(%rdi)  # TAILCALL

That's not quite right. The IR looks fine:

target datalayout =
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
target triple = "x86_64-unknown-linux-gnu"

%struct.X = type { void ()* }

define void @_Z9aux_closeP1X(%struct.X* nocapture %x) uwtable {
entry:
  %f = getelementptr inbounds %struct.X* %x, i64 0, i32 0
  %0 = load void ()** %f, align 8, !tbaa !0
  store void ()* null, void ()** %f, align 8, !tbaa !0
  tail call void %0()
  ret void
}

!0 = metadata !{metadata !"any pointer", metadata !1}
!1 = metadata !{metadata !"omnipotent char", metadata !2}
!2 = metadata !{metadata !"Simple C/C++ TBAA"}

-- 
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