[libcxx-commits] [libcxx] [libc++] Fix possible out of range access in bitset (PR #121348)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jun 11 09:26:45 PDT 2025


ldionne wrote:

> @winner245 You're still adding branches here which are effectively dead code AFAICT. I'm not against fixing bugs, but I am against introducing effectively dead code. Given that your commit message starts with that case, it seems like it is the most important part of the patch. If it's not, I'd rip these parts out to make the actual intention clear.

I think I'm not following fully here. Looking at the code *after* the patch, I don't see what part of it is dead code. We do have platforms where `size_t` is 32 bits, which means the ratio between `unsigned long long` (64 bits) and `size_t` is `2`. It is true that we don't officially support any platform where `size_t` is 16 bits, but I don't think this patch introduces any specific code to handle this. It just handles all sizes generically in a correct way, and this happens to also work for a 16 bit `size_t`. Perhaps the commit message needs to be adjusted to explain the motivation more clearly?

If I missed something and there is indeed dead code being introduced, then I agree that we shouldn't be checking in dead code -- but I'm not seeing anything dead in the latest version of the patch.

https://github.com/llvm/llvm-project/pull/121348


More information about the libcxx-commits mailing list