summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Tooling/SourceCodeTest.cpp
diff options
context:
space:
mode:
authorPetar Jovanovic <petar.jovanovic@mips.com>2019-04-05 12:58:15 +0000
committerPetar Jovanovic <petar.jovanovic@mips.com>2019-04-05 12:58:15 +0000
commit2b2f35a4e94c9da147bd5a07f23c776fdf17881f (patch)
treedc2a14fd60aa78e1c73259c4d2b6219b322337cf /clang/unittests/Tooling/SourceCodeTest.cpp
parentafb54fd629d44945bb29913fa8dc386f8f20263a (diff)
downloadbcm5719-llvm-2b2f35a4e94c9da147bd5a07f23c776fdf17881f.tar.gz
bcm5719-llvm-2b2f35a4e94c9da147bd5a07f23c776fdf17881f.zip
[TextAPI] Fix off-by-one error in the bit index extraction loop
The loop in findNextSetBit() runs one pass more than it should. On 64-bit architectures this does not cause a problem, but 32-bit architectures mask the shift count to 5 bits which limits the number of shifts inside a range of 0 to 31. Shifting by 32 has the same effect as shifting by 0, so if the first bit in the set is 1, the function will return with Index different from EndIndexVal. Because of that, range-based for loops iterating thorough architectures will continue until hitting a 0 in the set, resulting in n additional iterations, where n is equal to the number of consecutive 1 bits at the start the set. Ultimately TBDv1.WriteFile and TBDv2.WriteFile will output additional architectures causing a failure in the unit tests. Patch by Milos Stojanovic. Differential Revision: https://reviews.llvm.org/D60198 llvm-svn: 357759
Diffstat (limited to 'clang/unittests/Tooling/SourceCodeTest.cpp')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud