[clang] fix sema init crashing on initialization sequences by yuxuanchen1997 · Pull Request #98102 · llvm/llvm-project (original) (raw)

@llvm/pr-subscribers-clang

Author: Yuxuan Chen (yuxuanchen1997)

Changes

We ran into a FE crash and root caused to ER.get() on line 5584 here being nullptr. I think this is a result of not checking if ER here is invalid.

We have been using automated reduction tools (like CReduce) for a while and it is not performing well and would like to ask upstream opinions on whether this condition here is handled correctly. Preferably with help to write a small, well contained crash-on-valid test case.

I do have a crash-on-invalid test here, would really appreciate any pointers.


Full diff: https://github.com/llvm/llvm-project/pull/98102.diff

1 Files Affected:

diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp index 41753a1661ace..80286302e9b9d 100644 --- a/clang/lib/Sema/SemaInit.cpp +++ b/clang/lib/Sema/SemaInit.cpp @@ -5576,6 +5576,10 @@ static void TryOrBuildParenListInitialization( ExprResult ER; ER = IS.Perform(S, SubEntity, SubKind, Arg ? MultiExprArg(Arg) : std::nullopt); +