[PATCH] D153969: [clang][ExprConstant] Fix crash on uninitialized base class subobject

Takuya Shimizu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 28 06:37:41 PDT 2023


hazohelet added inline comments.


================
Comment at: clang/lib/AST/ExprConstant.cpp:2379
   if (!Value.hasValue()) {
     assert(SubobjectDecl && "SubobjectDecl shall be non-null");
     Info.FFDiag(DiagLoc, diag::note_constexpr_uninitialized) << SubobjectDecl;
----------------
The reason I put the assertion here in the original patch was that there were not enough test cases to see what could cause null here, and I thought we could rethink later about this assertion's validness through crash reports like this. FWIW, I thought this assertion could be beneficial at that time because it had caught two internal bugs.

If reviewers do not agree with the assertion here anymore, we can fallback to the old diagnostic(`subobject of type 'A' is not initialized`) when we have invalid subobject, or revert the original patch.
Currently this patch is a partial fallback to the old diagnostic.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153969/new/

https://reviews.llvm.org/D153969



More information about the cfe-commits mailing list