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: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to