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