[Issue 23936] ImportC: pragma pack is not working for concrete module (libuv)

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon May 29 07:33:03 UTC 2023


https://issues.dlang.org/show_bug.cgi?id=23936

--- Comment #1 from Walter Bright <bugzilla at digitalmars.com> ---
The problem can be duplicated with:

test.d:

  import impc;
  pragma(msg, "M128A.align ", M128A.alignof );
  pragma(msg, "_CONTEXT.align ", _CONTEXT.alignof );
  pragma(msg, "SomeType.align ", SomeType.alignof );

impc.i:

  __pragma(pack(push, 16))
  typedef struct /*garbage*/ {
        long long val;
  } SomeType, *PSomeType;
  __pragma(pack(pop))

  #pragma pack(push,16)
  __pragma(pack(push,16))
  typedef struct /*__declspec(align(16))*/ _M128A {
    long long Low;
    long long High;
  } M128A, *PM128A;
  __pragma(pack(pop))
  #pragma pack(pop)

  #pragma pack(push,16)
  __pragma(pack(push,16))
  typedef struct _CONTEXT {
    int LastExceptionFromRip;
  } CONTEXT, *PCONTEXT; //__attribute__((aligned( 16))), *PCONTEXT;
  __pragma(pack(pop))
  #pragma pack(pop)

compiling:

  M128A.align 8LU
  _CONTEXT.align 4LU
  SomeType.align 16LU

Something seems wrong with __pragma.

--


More information about the Digitalmars-d-bugs mailing list