[libcxx-commits] [PATCH] D101206: [libc++] Remove UB in std::list

Amy Huang via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Apr 26 09:49:02 PDT 2021


akhuang added a comment.

In D101206#2714550 <https://reviews.llvm.org/D101206#2714550>, @Quuxplusone wrote:

> @Mordante: yes it does. :)
> @akhuang: My understanding is that removing-the-UB is needed (or at least desired) for the benefit of some particular sanitizer; could you add info to the review summary (and commit message) about that?
> Also, are we really interested in getting that benefit for C++03 code?  Arguably it would be better to preserve the existing behavior for C++03 and fix the behavior only for C++>=11. Is it physically possible to go that route? and if so, does that eliminate a lot of the ifdefs in this PR? (I'm thinking we could just have one ifdef around the `union` itself, and then the rest of the code wouldn't need ifdefs at all.) The behavior would remain UB, but unchanged, in C++03; and we could say "if you want to use such-and-such sanitizer, please compile as C++>=11." That won't be a hardship for the user, will it?

So the motivation for this is for a debug info optimization that homes debug info for classes to their constructors, and it relies on constructors being called (and we'd like to enable that mode by default in llvm). We don't necessarily care whether there's UB or not, but in this situation we wouldn't have debug info for these types.

I think making it only work for only C++>=11 could be fine, though.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101206



More information about the libcxx-commits mailing list