Issue 165867
Summary UB in std::vector<bool> constructors (read of uninitialized memory)
Labels libc++
Assignees
Reporter nunoplopes
    Some `std::vector<bool>` constructors read uninitialized memory.
They call __vallocate, which calls new, but doesn't zero the allocated buffer. Constructors then use std::fill_n and std::copy, which in turns sets bit by bit. Since storing a bit involving reading the byte first, this operations ends up reading uninitialized memory.

This simple example clearly shows the loads directly from the new operator: https://gcc.godbolt.org/z/vKaPnfT5M

cross ref (libstdc++ has the same bug): https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122506
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to