[clang] [clang][ExprConst] Fix crash on uninitialized array subobject (PR #67817)
Shafik Yaghmour via cfe-commits
cfe-commits at lists.llvm.org
Sun Oct 1 21:18:26 PDT 2023
================
@@ -2411,10 +2411,15 @@ static bool CheckEvaluationResult(CheckEvaluationResultKind CERK,
const FieldDecl *SubobjectDecl,
CheckedTemporaries &CheckedTemps) {
if (!Value.hasValue()) {
- assert(SubobjectDecl && "SubobjectDecl shall be non-null");
- Info.FFDiag(DiagLoc, diag::note_constexpr_uninitialized) << SubobjectDecl;
- Info.Note(SubobjectDecl->getLocation(),
- diag::note_constexpr_subobject_declared_here);
+ if (SubobjectDecl) {
----------------
shafik wrote:
So if we look back at https://reviews.llvm.org/D146358 you used to get the location which could be invalid and the diagnostic that was based on that is now lost b/c we lost that information b/c in many cases you just pass `nullptr` explicitly. So Perhaps you should have been encoding that information as well and then understand why that is important here.
https://github.com/llvm/llvm-project/pull/67817
More information about the cfe-commits
mailing list