[libcxx-commits] [PATCH] D108389: [libc++] Bypass calling exception-throwing functions in the dylib with -fno-exceptions

James Y Knight via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Aug 24 15:33:05 PDT 2021


jyknight added a comment.

In D108389#2955525 <https://reviews.llvm.org/D108389#2955525>, @ldionne wrote:

> To answer your question more directly, the goal here in terms of behavior is to ensure that a TU using `std::vector::at` (and friends) under `-fno-exceptions` doesn't rely on a weak-def symbol located in the dylib -- which it technically doesn't need cause all we do is `abort()` anyway.

This does not seem like a desirable change.

Previously, if you compiled libc++ itself with exceptions (as is generally the case), then a call to `std::vector::at` from a TU with -fno-exceptions _does_ still throw an exception. Of course, this exception cannot validly unwind through that TU, so it will eventually call std::terminate -- but not before printing its error message (e.g. "terminating with uncaught exception of type std::out_of_range: vector").

Switching to call abort() directly is a degradation in functionality, for no real gain, AFAICT.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108389



More information about the libcxx-commits mailing list