MaskRay added a comment.

I think improving diagnostic is useful but `-fsanitize=` is probably not a good 
place. Instrumenting call sites with `callq   
__ubsan_handle_exception_escape@PLT` wastes code size. The functionality is 
better handled somewhere in libc++abi personality related code with possible 
improvement to exception handling related LLVM IR.

  void bar(); void foo() { bar(); }

I wish that I capture the compiler and runtime behavior well in 
https://maskray.me/blog/2020-12-12-c++-exception-handling-abi#compiler-behavior.
 
https://discourse.llvm.org/t/catching-exceptions-while-unwinding-through-fno-exceptions-code/57151
 is a proposal to improve the diagnostics.

`clang++ -fno-exceptions -fsanitize=exception-escape -c b.cc` does not 
instrument the potentially-throwing-and-propagating `bar()` so an error cannot 
be caught.
However, for `-fno-exceptions` code, instrumenting every call site is going to 
greatly increase code size and suppress optimizations.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137901/new/

https://reviews.llvm.org/D137901

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to