[LLVMbugs] [Bug 17299] New: problem with long long bitfield

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Sep 20 02:07:58 PDT 2013


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

            Bug ID: 17299
           Summary: problem with long long bitfield
           Product: clang
           Version: 3.2
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: yflelion at hotmail.fr
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 11245
  --> http://llvm.org/bugs/attachment.cgi?id=11245&action=edit
problem with long long bitfield

Hello,

I find that there is a problem when a bitfield of size greater than 32 bits are
used (with a long long), which is not in the ansi c (although there is no error
message or warning when it is used).

The problem arises when we take for example a 40-bit bitfield, and we shift it
to the left by 32(the result is 64-bit instead of 40), in contrast to what gcc
does.

In the attached file foo is equal to 0 with gcc (which seems the most correct)
and foo equals 0x10000000000 with clang.

In attached file you can find the example I used.

compilers used for comparison are:
clang: v3.2 (final tags/RELEASE_32)
             Target: x86_64-unknown-linux-gnu
             Thread model: posix
gcc (Ubuntu / Linaro 4.6.3-lubuntu5) 4.6.3

Thanks in advance for your help.

Best Regards,

Youssef Fahmi.

-- 
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/20130920/00a118e0/attachment.html>


More information about the llvm-bugs mailing list