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

            Bug ID: 20418
           Summary: MS ABI: __declspec(align(N)) ignored inside pragma
                    pack when applied to a non-record type
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected]
    Classification: Unclassified

Consider:
typedef __declspec(align(4)) int my_int_t;
#pragma pack(1)
struct A {
  char a;
  my_int_t x;
};
static_assert(sizeof(A) == 8, "");

MSVC record layout tracks two kinds of alignment: required and natural
alignment.  Inside pragma pack, "required" alignment (alignment from
attributes) trumps the pragma pack alignment.  However, only records have a
concept of required alignment.  Typedefs of scalar types can also have a
required alignment, and we need to track it.

We would also need to track this in the Itanium C++ record layout code if we
want to implement this there, either in general or under ms_struct, as
discussed here:
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2014-July/038193.html

getTypeInfo should probably be augmented to return more information: size,
natural alignment, required alignment.

-- 
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