[llvm-bugs] [Bug 38487] New: Invalid fastcc function signatures when inlining `this` into multiple parameters and there is inalloca parameters

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Aug 8 10:31:23 PDT 2018


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

            Bug ID: 38487
           Summary: Invalid fastcc function signatures when inlining
                    `this` into multiple parameters and there is inalloca
                    parameters
           Product: clang
           Version: 6.0
          Hardware: PC
                OS: Windows XP
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ngg at tresorit.com
                CC: llvm-bugs at lists.llvm.org

The following code has an assertion failure:

fatal error: error in backend: any parameter with the inalloca attribute must
be the only memory argument

The bug is happening both with clang 6.0.1 and 7.0.0 RC1.
Compile with: clang++ -target i386-pc-windows-msvc -O3 -c x.cpp

The F::k function gets the following signature:
define internal fastcc void @"\01?k at F@?A@@QAEXUY@@@Z"(i32, i32, i32, <{
%struct.Y }>* inalloca) unnamed_addr #0 align 2

This is not callable because there cannot be any more memory arguments if there
is inalloca, and the 3 ints are too many to be passed in registers.


// x.cpp
// clang++ -target i386-pc-windows-msvc -O3 -c x.cpp

struct Y
{
    int i; 
    Y();
    Y(const Y&);
};

void h(Y y);

namespace {
struct F {
    int i1, i2, i3;

    void k(Y y) {
        y.i = i1+i2+i3;
        h(y);
    }
};
}

void foo()
{
    F f;
    Y y;
    f.k(y);
}

-- 
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/20180808/dd25a11d/attachment.html>


More information about the llvm-bugs mailing list