[LLVMbugs] [Bug 19007] New: Destructor alias emission ignores calling convention

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Feb 28 07:32:30 PST 2014


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

            Bug ID: 19007
           Summary: Destructor alias emission ignores calling convention
           Product: clang
           Version: trunk
          Hardware: PC
               URL: http://www.freebsd.org/cgi/query-pr.cgi?pr=187103
                OS: All
            Status: NEW
          Keywords: miscompilation
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: benny.kra at gmail.com
                CC: llvmbugs at cs.uiuc.edu, rafael.espindola at gmail.com
    Classification: Unclassified

Here's a mildly insane test case reduced from mozilla.

$ cat t.cc
#define NS_CONSTRUCTOR_FASTCALL __attribute__ ((regparm (3), stdcall))

struct nsCOMPtr_base {
  NS_CONSTRUCTOR_FASTCALL ~nsCOMPtr_base() {}
};

struct nsCOMPtr : private nsCOMPtr_base {};

int main() {
  nsCOMPtr ptr;
}

$ clang -target i386-linux-gnu -O1 -Xclang -disable-llvm-optzns -flto -S -o -
t.cc
define i32 @main() #0 {
entry:
  %ptr = alloca %struct.nsCOMPtr, align 1
  call void bitcast (void (%struct.nsCOMPtr_base*)* @_ZN13nsCOMPtr_baseD2Ev to
void (%struct.nsCOMPtr*)*)(%struct.nsCOMPtr* %ptr)
  ret i32 0
}

define linkonce_odr x86_stdcallcc void
@_ZN13nsCOMPtr_baseD2Ev(%struct.nsCOMPtr_base* inreg %this)



Here we create a call to @_ZN13nsCOMPtr_baseD2Ev without adding the
x86_stdcallcc attribute to the call. The optimizer will turn this into a call
to @llvm.trap.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140228/3811b20d/attachment.html>


More information about the llvm-bugs mailing list