[PATCH] D35438: CodeGen: Ensure there is basic block when performing address space cast
John McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 14 19:49:15 PDT 2017
rjmccall added a comment.
Oh, of course. Sadly, in C/C++ the declaration point of a variable does not necessarily dominate all uses of the variable, so you need to emit the cast immediately after the alloca. Just temporarily move CGF.Builder to that point; hopefully we can assume that this function will never try to add control flow.
Test case:
extern void use(int*);
void foo() {
goto later;
int x;
later:
use(&x);
}
https://reviews.llvm.org/D35438
More information about the cfe-commits
mailing list