]> granicus.if.org Git - clang/commit
Fix thunks returning memptrs via sret by emitting also scalar return values directly...
authorHans Wennborg <hans@hanshq.net>
Fri, 7 Dec 2018 08:17:26 +0000 (08:17 +0000)
committerHans Wennborg <hans@hanshq.net>
Fri, 7 Dec 2018 08:17:26 +0000 (08:17 +0000)
commit7a8ab4b1a1ca73f814f135bf18bc81608fd3a980
tree10547d740fd94540f1104819d20c16ff871f66c2
parent4bd0dec5885e171d5055d980d3121c1d8115655b
Fix thunks returning memptrs via sret by emitting also scalar return values directly in sret slot (PR39901)

Thunks that return member pointers via sret are broken due to using temporary
storage for the return value on the stack and then passing that pointer to a
tail call, violating the rule that a tail call can't access allocas in the
caller (see bug).

Since r90526, we put aggregate return values directly in the sret slot, but
this doesn't apply to member pointers which are considered scalar.

Unless I'm missing something subtle, we should be able to always use the sret
slot directly for indirect return values.

Differential revision: https://reviews.llvm.org/D55371

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@348569 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/CGVTables.cpp
lib/CodeGen/CodeGenFunction.cpp
test/CodeGenCXX/thunk-returning-memptr.cpp [new file with mode: 0644]