[LLVMbugs] [Bug 17283] New: bit operations optimised incorrectly

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Sep 19 00:52:11 PDT 2013


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

            Bug ID: 17283
           Summary: bit operations optimised incorrectly
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: mjjunk47 at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 11234
  --> http://llvm.org/bugs/attachment.cgi?id=11234&action=edit
clang_packedbits_bug.C

Dear clang team,

Attached a simple test code which uses hamming weights to calculate the bit
count. I gives the correct result when compiled without optimisation but
incorrect when compiled with -O.

UNIX> clang++ clang_packedbits_bug.C 
UNIX> ./a.out 
c:316


UNIX> clang++ -O clang_packedbits_bug.C
UNIX> ./a.out
c:0

If I add e.g. any printing to the loop it is ok as well.

-- 
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/20130919/76e0fb26/attachment.html>


More information about the llvm-bugs mailing list