I work at Intel, and we have developed a tool that detects anomalous programming language expressions that can possibly lead to bugs. We scanned the code repository for this project as it has considerably high number of stars!
We found a couple of places where the code/expressions are confusing and seem to implement the logic in a rather convoluted manner. We think that the expressions could be rewritten to capture the logic accurately and precisely.
The if expression in the following code performs bitwise OR to check that the pointers are not NULL (if I'm correct). Bitwise OR operator in C does not go through short-circuit evaluation. As a result, all subexpressions (pointer derefs) are evaluated, leading to lost optimization opportunity. Boolean OR can help with such an optimization.
Hi,
I work at Intel, and we have developed a tool that detects anomalous programming language expressions that can possibly lead to bugs. We scanned the code repository for this project as it has considerably high number of stars!
We found a couple of places where the code/expressions are confusing and seem to implement the logic in a rather convoluted manner. We think that the expressions could be rewritten to capture the logic accurately and precisely.
Case 1) Expression at line 839 in c-blosc/internal-complibs/zstd-1.3.4/compress/zstdmt_compress.c
The
if
expression in the following code performs bitwise OR to check that the pointers are not NULL (if I'm correct). Bitwise OR operator in C does not go through short-circuit evaluation. As a result, all subexpressions (pointer derefs) are evaluated, leading to lost optimization opportunity. Boolean OR can help with such an optimization.Case 2) Similar case for expression
(offsetCode | !litLength)
at line 2890 under c-blosc/internal-complibs/zstd-1.3.4/legacy/zstd_v04.c.Any thoughts?