Bug ID: 36685
           Summary: Possible false positive: takes branches that
                    contradict each other
           Product: clang
           Version: 6.0
          Hardware: Other
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer

Created attachment 20048
Source code of median search and reduced caller.

The attached reduced source code implements a fast median computation according
to [1] and contains a placeholder caller.

If the caller passes its input array directly, clang does not report any
If the caller copies its input array to a local array and then runs the median
computation (compile with "-DCOPY"), clang finds a bug.
I therefore suspect a false positive.

The path it takes assumes the following conditions:

Lines 38--40:
array[1] <= array[2]
array[0] <= array[2]
array[1] <= array[0]

Line 43:
Swapping is a NOP due to middle == low + 1.

Lines 50:
array[0] > array[2]

This contradicts assumption array[0] <= array[2], hence the reported bug should
be impossible and thus a false positive.


You are receiving this mail because:
You are on the CC list for the bug.
llvm-bugs mailing list

Reply via email to