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: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    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.
_______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to