rnk added a comment. In https://reviews.llvm.org/D50805#1201805, @rsmith wrote:
> There is no guarantee that you can use an address-of-label value from one > function invocation in another invocation of the same function. GCC's > documentation says it's the user's own problem to prevent inlining and > cloning if the program requires an address-of-label extension to always > produce the same value for multiple invocations of the function. It might > make sense to suppress the warning in the case where the function is > `__attribute__((noinline))`, though. That's interesting. I'm pretty sure LLVM will not inline a function that has `indirectbr` to avoid this problem. I think the state machine use case is real, though, something like: void *f(void *startlabel) { common_work(); goto *startlabel; state1: return &&state2; state2: return &&state3; ... } I think that, ultimately, this warning isn't worth the code complexity in clang to support it. Suppressing it under noinline doesn't solve the original statement expression issue either, and creates more unnecessary code complexity. Are we really worried about users doing this? void *f() { return &&next; next: ... } void g() { void *pc = f(); goto *pc; // cross-functional frame re-entry! =D } https://reviews.llvm.org/D50805 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits