This is an archive of the discontinued LLVM Phabricator instance.

[AST] Fix a constexpr-evaluator crash on error-dependent returnstmt.
ClosedPublic

Authored by hokein on Dec 9 2020, 1:53 PM.

Details

Summary

When the evaluator encounters an error-dependent returnstmt, before this patch
it returned a ESR_Returned without setting the result, the callsides think this
is a successful execution, and try to access the Result which causes the crash.

The fix is to always return failed as we don't know the result of the
error-dependent return stmt.

Diff Detail

Event Timeline

hokein requested review of this revision.Dec 9 2020, 1:53 PM
hokein created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptDec 9 2020, 1:53 PM
sammccall accepted this revision.Dec 10 2020, 12:34 AM
sammccall added inline comments.
clang/lib/AST/ExprConstant.cpp
5147

this deserves a comment: // We know we returned, but we don't know what the value is.

This revision is now accepted and ready to land.Dec 10 2020, 12:34 AM
This revision was landed with ongoing or failed builds.Dec 10 2020, 1:12 AM
This revision was automatically updated to reflect the committed changes.
hokein marked an inline comment as done.