[LLVMbugs] [Bug 21343] AND operator compiled like OR operator (and vice versa) in FOR loop with text arrays

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Oct 23 11:42:48 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=21343

Anton <anton.travnikov at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|---                         |WORKSFORME

--- Comment #4 from Anton <anton.travnikov at gmail.com> ---
(In reply to comment #3)
> OR is the required operation for the logic you're trying to do.
> 
> You want the loop to stop when (s[tmp_i] == '*' && s[tmp_i + 1] == '/')
> right? So you need to loop while the opposite is true. Which would be
> !(s[tmp_i] == '*' && s[tmp_i + 1] == '/'). If we apply DeMorgan's law to
> propagate the inversion all the way through, we get (s[tmp_i] != '*' ||
> s[tmp_i + 1] != '/'). Which is what your code has.

Thank you very much for exhaustive explanations!

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20141023/5ffb63ca/attachment.html>


More information about the llvm-bugs mailing list