Skip to content

Commit 54b022d

Browse files
labathzmodem
authored andcommitted
[lldb] Fix nondeterminism in TestCppBitfields
The test was printing a char[3] variable without a terminating nul. The memory after that variable (an unnamed bitfield) was not initialized. If the memory happened to be nonzero, the summary provider for the variable would run off into the next field. This is probably not the right behavior (it should stop at the end of the array), but this is not the purpose of this test. I have filed pr44649 for this bug, and fixed the test to not depend on this behavior. (cherry picked from commit 77cedb0)
1 parent 6472fec commit 54b022d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lldb/packages/Python/lldbsuite/test/lang/cpp/bitfields/TestCppBitfields.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def test_and_run_command(self):
8080
"frame variable --show-types lbd",
8181
VARIABLES_DISPLAYED_CORRECTLY,
8282
substrs=[
83-
'(char [3]) arr = "abc"',
83+
'(char [3]) arr = "ab"',
8484
'(int:32) =',
8585
'(unsigned int:20) a = 5',
8686
])

lldb/packages/Python/lldbsuite/test/lang/cpp/bitfields/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ int main(int argc, char const *argv[]) {
7373

7474
lbd.arr[0] = 'a';
7575
lbd.arr[1] = 'b';
76-
lbd.arr[2] = 'c';
76+
lbd.arr[2] = '\0';
7777
lbd.a = 5;
7878

7979

0 commit comments

Comments
 (0)