scan-build of msort.c reports "garbage value" in conditional
charles-randall opened this issue · comments
charles-randall commented
Using scan-build,
https://clang-analyzer.llvm.org/scan-build.html
Didn't investigate, but look at the third error,
$ scan-build clang msort.c -lm
scan-build: Using '/usr/lib/llvm-10/bin/clang' for static analysis
msort.c:38:5: warning: Value stored to 'endpos1' is never read
endpos1 = length1;
^ ~~~~~~~
msort.c:39:5: warning: Value stored to 'endpos2' is never read
endpos2 = length2;
^ ~~~~~~~
msort.c:189:15: warning: The left operand of '==' is a garbage value
} while(x == y && i < endpos1 && j < endpos2);
~ ^
msort.c:791:9: warning: Value stored to 'k' is never read
k = 0;
^ ~
4 warnings generated.
scan-build: 4 bugs found.
If you run this yourself, you can use "scan-view" to examine the report in detail.