This is an archive of the discontinued LLVM Phabricator instance.

[Verifier] Check catchpad for MSVC_CXX Personality
AcceptedPublic

Authored by pengfei on May 23 2023, 7:09 AM.

Details

Summary

An alternative to D143739.

Diff Detail

Event Timeline

pengfei created this revision.May 23 2023, 7:09 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 23 2023, 7:09 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
pengfei requested review of this revision.May 23 2023, 7:09 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 23 2023, 7:09 AM
pengfei retitled this revision from [Verifier] Check catchpad for WinEH to [Verifier] Check catchpad for MSVC_CXX Personality.May 23 2023, 7:16 AM
rnk accepted this revision.May 23 2023, 9:00 AM
rnk added a subscriber: akhuang.

lgtm, thanks!

This will, for example, prevent a pass like ASan from moving the catch object into the dynamic stack allocation. And, it looks like we have that exact bug:
https://gcc.godbolt.org/z/3aveP3rbj

See the IR, which uses a catch object based on the dynamic alloca:

  store i64 %11, ptr %asan_local_stack_base, align 8
  %12 = add i64 %11, 32
  %13 = inttoptr i64 %12 to ptr
...
catch:                                            ; preds = %catch.dispatch
  %24 = catchpad within %23 [ptr @"??_R0H@8", i32 0, ptr %13], !dbg !19

So, this will break builds using ASan and WinEH, but they are already known to be incompatible. +@akhuang

This revision is now accepted and ready to land.May 23 2023, 9:00 AM