LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 19007 - Destructor alias emission ignores calling convention
Summary: Destructor alias emission ignores calling convention
Status: RESOLVED FIXED
Alias: None
Product: clang
Classification: Unclassified
Component: LLVM Codegen (show other bugs)
Version: trunk
Hardware: PC All
: P normal
Assignee: Unassigned Clang Bugs
URL: http://www.freebsd.org/cgi/query-pr.c...
Keywords: miscompilation
Depends on:
Blocks:
 
Reported: 2014-02-28 09:32 PST by Benjamin Kramer
Modified: 2014-03-05 15:05 PST (History)
5 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Kramer 2014-02-28 09:32:30 PST
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.
Comment 1 Rafael Ávila de Espíndola 2014-03-05 15:05:17 PST
fixed in r203007 .