-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Closed
Labels
llvm:adtquestionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!
Description
consider the following crashing code:
SmallBitVector BV(31, true);
BV.reset(30, 32);expected behavior: bits 30, 31 are reset
actual behavior: assertion crash:
at llvm-project/llvm/include/llvm/ADT/SmallBitVector.h:420
420 assert(E <= size() && "Attempted to reset out-of-bounds range!");it should check E <= size() + 1 since the end is not included in the range (at least according to the docs).
I am not good enough with bits and bytes to solve the algorithm however and a dumb change of adding one in that check may or may not cause UB later without special handling.
Smae error happens with BitVector with the same assertion. this is a classic off-by-one.
Metadata
Metadata
Assignees
Labels
llvm:adtquestionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!