[llvm-bugs] [Bug 42642] New: std::nullptr_t in aggregates does not follow ABI

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jul 16 10:27:29 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=42642

            Bug ID: 42642
           Summary: std::nullptr_t in aggregates does not follow ABI
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: mvels at google.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

When you create a trivial aggregate containing std::nullptr_t, it does not get
passed through RDI/RSI, but gets classified as a memory arg

E.g.:


struct MyVar1 {
    int x = 3;
    std::nullptr_t n = nullptr;
};

void Foo(MyVar1 x);

void CallMyVar1() {
    MyVar1 m;
    Foo(m);  // Sets up stack frame and passes as pointer / MEMORY
}


GCC does this correct. 

More elaborate examples: https://gcc.godbolt.org/z/IxLudk

-- 
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/20190716/a1f85fd5/attachment.html>


More information about the llvm-bugs mailing list