[LLVMbugs] [Bug 21343] New: AND operator compiled like OR operator in FOR loop with text arrays

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Oct 22 12:41:23 PDT 2014


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

            Bug ID: 21343
           Summary: AND operator compiled like OR operator in FOR loop
                    with text arrays
           Product: clang
           Version: unspecified
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: anton.travnikov at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 13237
  --> http://llvm.org/bugs/attachment.cgi?id=13237&action=edit
Source code of my program

Hello!

I'm just learning to C and reads "K&R C" textbook. And while I'm did the 23rd
exercise (remove all comments from a C program), I am encountered with the
problem:
like you can see on 51-th string of attached program, me necessary use of OR
operator instead of AND in FOR loop, because OR operator in that case works
like AND and program works well. If I'm attempts to use WHILE loop instead of
FOR loop, thats mistake arise in WHILE loop (code of WHILE loop is commented,
and you can attempt use it instead of FOR). Strings number 49-50 and 58
contains debug code that prints values of variables, numbers of strings with
comments and control pair of characters in array (/* or */) before processed
text of C program.
If you attempt execute the program, at first whether with || and them with &&
in FOR loop or with WHILE loop with same couple of operands you will see vary.
My english is not so good, but I'm hope that you will understand :)
______

Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.0.0
Thread model: posix

-- 
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/20141022/85ddc361/attachment.html>


More information about the llvm-bugs mailing list