[LLVMbugs] [Bug 19640] New: Win64 MS ABI: Classes with non-trivial dtors and trivial copy ctors are passed in registers
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Fri May 2 11:10:01 PDT 2014
http://llvm.org/bugs/show_bug.cgi?id=19640
Bug ID: 19640
Summary: Win64 MS ABI: Classes with non-trivial dtors and
trivial copy ctors are passed in registers
Product: clang
Version: unspecified
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: LLVM Codegen
Assignee: unassignedclangbugs at nondot.org
Reporter: rnk at google.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
consider:
struct S {
S(int a) : a(a) {}
~S() {}
int a;
};
void foo(S s);
int main() {
foo(S(42));
}
foo's parameter is passed in ecx on x64. However, Clang doesn't consider this
type to be "trivially copyable", so we try to pass it indirectly.
If we pass the parameter in registers, then the object is reconstituted on the
other side with a new address, which can be observed. Therefore we cannot copy
elide this argument. We have to construct the temporary in the caller's frame,
destroy the temporary after the call, *and* the callee will destroy its copy at
the end of foo.
If the parameter is passed in memory, it receives the same treatment: a
temporary is constructed in the caller, its bytes are copied into the argument
slot, and it is destroyed in the caller and callee. It is possible to use
inalloca to copy elide when the argument is in memory, but it is potentially
hostile to optimization.
--
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/20140502/81deeb51/attachment.html>
More information about the llvm-bugs
mailing list