This is an archive of the discontinued LLVM Phabricator instance.

[SEH] fix assertion when -fasy-exceptions is used.
ClosedPublic

Authored by jyu2 on Aug 9 2023, 5:57 PM.

Details

Summary

The assertion only happens with use of -fasy-exception without
-fexcessions.

The assertion appen during the call to generate SehScopeBegin(), where
assert with:
assert(CGF.Builder.GetInsertBlock() && InvokeDest);
InvokeDest is null. Because exceptions are disabled, and SEH is not
in use.
The fix is before call EmitSehCppScopeBegin check getInvokeDest(),
to avoid assert during the emit llvm.seh.scope.begin()

Diff Detail

Event Timeline

jyu2 created this revision.Aug 9 2023, 5:57 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 9 2023, 5:57 PM
jyu2 requested review of this revision.Aug 9 2023, 5:57 PM
pengfei accepted this revision.Aug 10 2023, 8:02 AM

LGTM.

This revision is now accepted and ready to land.Aug 10 2023, 8:02 AM
rnk accepted this revision.Aug 10 2023, 10:03 AM
asmith accepted this revision.Aug 10 2023, 10:13 AM
asmith added inline comments.
clang/test/CodeGen/windows-seh-async-exceptions.cpp
22

nit; spacing

jyu2 updated this revision to Diff 549174.Aug 10 2023, 2:39 PM

Thanks all for the review! This is fix space problem.

This revision was automatically updated to reflect the committed changes.