[LLVMbugs] [Bug 16551] New: Incorrect code for accessing a struct variable with bit fields

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jul 5 19:15:59 PDT 2013


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

            Bug ID: 16551
           Summary: Incorrect code for accessing a struct variable with
                    bit fields
           Product: clang
           Version: trunk
          Hardware: PC
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ishiura-compiler at ml.kwansei.ac.jp
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Clang 3.4 (based on LLVM 3.4svn) for x86_64 target miscompiles the
following code.

  $ cat error.c 

  struct S1 {
    unsigned int m1 : 32;
    unsigned int m2 : 24;
    unsigned char m3;
  };

  struct S1 x = { 1U, 1U, 1U };

  int main(void)
  {
    if ( x.m2 != 1U ) __builtin_abort(); 
    return 0;
  }

  $ clang error.c
  $ ./a.out
  Abort trap: 6

The value of the x.m2 was 16777217 (x01000001). 

There was no problem with an x86 (32bit) target.

-- 
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/20130706/839df91f/attachment.html>


More information about the llvm-bugs mailing list