[cfe-commits] r112310 - /cfe/trunk/lib/Checker/UnreachableCodeChecker.cpp
Ted Kremenek
kremenek at apple.com
Fri Aug 27 16:16:54 PDT 2010
Great. Makes sense.
On Aug 27, 2010, at 4:12 PM, Tom Care wrote:
> Both, in a way.
>
> The problem is that a checker might place a sink somewhere that breaks this assumption. This could be due to a valid bug being found by another checker (eg, null deref). However this can also happen when another checker creates a sink incorrectly.
>
> If the sink is correct, then this assertion can trigger when there is a real bug. If the sink is incorrect, this assertion has the power to reveal it.
>
> The usual case so far has been this assertion triggering on correct sinks that happen to break the property.
>
> On Aug 27, 2010, at 4:02 PM, Ted Kremenek wrote:
>
>> Bugs in other checkers or bugs found by other checkers?
>>
>> On Aug 27, 2010, at 3:37 PM, Tom Care wrote:
>>
>>> Author: tcare
>>> Date: Fri Aug 27 17:37:31 2010
>>> New Revision: 112310
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=112310&view=rev
>>> Log:
>>> Remove an assertion in UnreachableCodeChecker that can be triggered by bugs in other checkers.
>>>
>>> Modified:
>>> cfe/trunk/lib/Checker/UnreachableCodeChecker.cpp
>>>
>>> Modified: cfe/trunk/lib/Checker/UnreachableCodeChecker.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/UnreachableCodeChecker.cpp?rev=112310&r1=112309&r2=112310&view=diff
>>> ==============================================================================
>>> --- cfe/trunk/lib/Checker/UnreachableCodeChecker.cpp (original)
>>> +++ cfe/trunk/lib/Checker/UnreachableCodeChecker.cpp Fri Aug 27 17:37:31 2010
>>> @@ -188,8 +188,11 @@
>>> // There will never be more than one predecessor.
>>> bool UnreachableCodeChecker::isInvalidPath(const CFGBlock *CB,
>>> const ParentMap &PM) {
>>> - // Assert this CFGBlock only has one or zero predecessors
>>> - assert(CB->pred_size() == 0 || CB->pred_size() == 1);
>>> + // We only expect a predecessor size of 0 or 1. If it is >1, then an external
>>> + // condition has broken our assumption (for example, a sink being placed by
>>> + // another check). In these cases, we choose not to report.
>>> + if (CB->pred_size() > 1)
>>> + return true;
>>>
>>> // If there are no predecessors, then this block is trivially unreachable
>>> if (CB->pred_size() == 0)
>>>
>>>
>>> _______________________________________________
>>> cfe-commits mailing list
>>> cfe-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>
>
More information about the cfe-commits
mailing list