This is an archive of the discontinued LLVM Phabricator instance.

[Clang][OpenMP] Bail out early if `Scope` is nullptr in case of any crash
ClosedPublic

Authored by tianshilei1992 on Jan 20 2023, 9:32 AM.

Details

Summary

When there is any compile error, clang still tries to compile as many code as
possible, therefore Scope can be nullptr here. However, we didn't check it
beforehand, causing compiler crash.

Fix #59944.

Diff Detail

Event Timeline

tianshilei1992 created this revision.Jan 20 2023, 9:32 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 20 2023, 9:32 AM
tianshilei1992 requested review of this revision.Jan 20 2023, 9:32 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 20 2023, 9:32 AM
ABataev added inline comments.Jan 20 2023, 9:35 AM
clang/lib/Sema/SemaOpenMP.cpp
7262

Maybe better to check it here to avoid too early exit?

if (Scope && Scope->...)
tianshilei1992 added inline comments.Jan 20 2023, 9:36 AM
clang/lib/Sema/SemaOpenMP.cpp
7262

But does it make sense to continue? I'm not that sure.

ABataev added inline comments.Jan 20 2023, 9:37 AM
clang/lib/Sema/SemaOpenMP.cpp
7262

Yes, we can get some extra diagnostics, which may be helpful

This revision is now accepted and ready to land.Jan 20 2023, 9:47 AM
This revision was landed with ongoing or failed builds.Jan 20 2023, 11:40 AM
This revision was automatically updated to reflect the committed changes.
tianshilei1992 marked an inline comment as done.