rsmith added a comment.

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.



================
Comment at: clang/lib/Sema/SemaInit.cpp:6919-6920
         // expression.
         if (LK == LK_StmtExprResult)
           return false;
         Diag(DiagLoc, diag::warn_ret_stack_addr_ref)
----------------
We should not be producing warnings on address-of-label cases for 
`LK_StmtExprResult`, similarly to what we do here for `DeclRefExpr`s. If we 
fixed that (which I think is just a bug I introduced while refactoring this 
code), we'd no longer reject the example from the Linux kernel.


https://reviews.llvm.org/D50805



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to