On Wed, Sep 12, 2012 at 3:07 PM, Sean McBride <span dir="ltr"><<a href="mailto:sean@rogue-research.com" target="_blank">sean@rogue-research.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Wed, 12 Sep 2012 14:30:32 -0700, Richard Trieu said:<br>
<br>
>One way that this may manifest is during<br>
>testing of enum values:<br>
><br>
>enum Foo { A = 0, B = 0 };<br>
>Foo f = B;<br>
>if (f == A)<br>
>  ActOnA();  // Runs since A == B<br>
>else if (f == B)<br>
>  ActOnB();  // Never runs.<br>
<br>
</div>Not to hijack your thread, and I know it's just one example.... but catching 'if' conditions that match previous ones would be valuable whether there are enums involved or not.  I filed a PR long ago:<br>

<<a href="http://llvm.org/bugs/show_bug.cgi?id=9193" target="_blank">http://llvm.org/bugs/show_bug.cgi?id=9193</a>><br>
<br>
This is something PVS Studio can catch!  An example I saw the other day:<br></blockquote><div>Does PVS Studio only catch identical conditional (x == 5 and later x == 5) or can it catch equivalent, but differently coded conditionals (x == 5 then x == 2 + 3)?</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
----------------------------------<br>
V517 The use of 'if (A) {...} else if (A) {...}' pattern was detected. There is a probability of logical error presence. Check lines: 224, 227. lproj lproj.c 224<br>
<br>
static void vprocess(FILE *fid) {<br>
  char *s;<br>
  ...<br>
  if (*s == 'I' || *s == 'i') {<br>
    linvers = 1;<br>
    ++s;<br>
  } else if (*s == 'I' || *s == 'i') {<br>
    linvers = 0;<br>
    ++s;<br>
  } else<br>
  ...<br>
}<br>
----------------------------------<br>
<br>
Cheers,<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
____________________________________________________________<br>
Sean McBride, B. Eng                 <a href="mailto:sean@rogue-research.com">sean@rogue-research.com</a><br>
Rogue Research                        <a href="http://www.rogue-research.com" target="_blank">www.rogue-research.com</a><br>
Mac Software Developer              Montréal, Québec, Canada<br>
<br>
<br>
</font></span></blockquote></div><br>