Optimize the control flow graph to reduce false positives #141
Labels
C-false-positive
Category: False Positive
C-feature-request
Category: Feature Request
L-c
Language: C
P-low
Priority: Low
The analyzer generates false positives when the code uses the following pattern:
The analyzer generates the following warning:
First, this code pattern is questionable and I would recommend not using it. It is hard to read and causes trouble to static analyzers. Prefer the early-return pattern, see this example.
Anyway, we could solve this false positive by optimizing the control flow graph. The current control flow graph is here. We could write an optimization pass that replaces the edge from
#3
to#4
by an edge from#3
to#6
. This would fix remove the warning.The text was updated successfully, but these errors were encountered: