[LLVMbugs] [Bug 20418] New: MS ABI: __declspec(align(N)) ignored inside pragma pack when applied to a non-record type

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jul 23 12:58:15 PDT 2014


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: unassignedclangbugs at nondot.org
          Reporter: rnk at google.com
                CC: david.majnemer at gmail.com, fjahanian at apple.com,
                    llvmbugs at cs.uiuc.edu, richard-llvm at metafoo.co.uk,
                    whunt at google.com
    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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140723/dcdd33e6/attachment.html>


More information about the llvm-bugs mailing list