[llvm-bugs] [Bug 26776] New: Arguments containing allocas for functions that use inalloca need to be evaluated first

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Feb 29 10:44:25 PST 2016


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

            Bug ID: 26776
           Summary: Arguments containing allocas for functions that use
                    inalloca need to be evaluated first
           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: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Consider:

int x = 10;
struct A { A(); ~A(); };
void foo(A, void*, A);
int main() {
  foo(A(), (++x, _alloca(x)), A());
}

Function call arguments need to live on the top of the stack, that's just how
they work. alloca, however, lets the programmer allocate stack memory from an
expression, which can break the call frame. MSVC overcomes this problem by
evaluating arguments that contain calls to alloca before the outermost call
expression. This is legal because argument evaluation order is unsequenced. We
should do the same thing in Clang at some point.

-- 
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/20160229/879fff8f/attachment-0001.html>


More information about the llvm-bugs mailing list