rsmith added inline comments.
================ Comment at: clang/lib/CodeGen/CGCall.cpp:2110 + DetermineNoUndef(RetTy, getTypes(), DL, RetAI)) { + RetAttrs.addAttribute(llvm::Attribute::NoUndef); + } ---------------- rsmith wrote: > This only applies in C++. In C, it's valid for a function to omit its > `return` statement if the result value is unused, and in that case the > returned value will legitimately be `undef`. > > Even in C++, we're conservative about enforcing the constraint that functions > return a proper value and control flow doesn't just fall off the bottom of > the function. See the full set of checks here: > https://github.com/llvm/llvm-project/blob/master/clang/lib/CodeGen/CodeGenFunction.cpp#L1322 It would seem sensible to suppress this for `extern "C"` functions too, on the basis that the definition of such functions is probably in C code, and thus they might return `undef`. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D81678/new/ https://reviews.llvm.org/D81678 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits