https://llvm.org/bugs/show_bug.cgi?id=25707

            Bug ID: 25707
           Summary: [GCC compatibility] different layout for ms_struct
                    with bit-field
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

$ cat test3.c
#include <stddef.h>
#include <stdio.h>

struct __attribute__((ms_struct)) B {
  char AField;
  int b : 1;
  char BField;
};

int main() {
  printf("sizeof(struct B) = %ld\n", sizeof(struct B));
  printf("offsetof(struct B, BField) = %ld\n", offsetof(struct B, BField));
  printf("__alignof(struct B) = %ld\n", __alignof(struct B));
}

$ clang test3.c && ./a.out
sizeof(struct B) = 12
offsetof(struct B, BField) = 8
__alignof(struct B) = 4

$ gcc test3.c && ./a.out
sizeof(struct B) = 8
offsetof(struct B, BField) = 5
__alignof(struct B) = 4

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to