My favorites | Sign in
Project Home Wiki Issues Source
New issue   Search
  Advanced search   Search tips   Subscriptions
Issue 50: #pragma pack(1) BUG
4 people starred this issue and may be notified of changes. Back to list
Status:  Waiting
Owner:  ----

Sign in to add a comment
Reported by, Sep 21, 2007
What steps will reproduce the problem?

#pragma pack(1)
typedef struct{
  unsigned short a
} A;

int main()

What is the expected output? What do you see instead?
Expect to get "2", but see "4" instead.

What version of the product are you using? On what operating system?
Revision: 172 - 174 (earlier revisions not tested yet)

MacOS X 10.4.10

Please provide any additional information below.
Sep 23, 2007
Project Member #1
Have you tried __attribute__((packed))? #pragma pack is the Microsoft way of doing things and while GCC may 
support it I'm not sure if LLVM-GCC does.
Status: Waiting
Sep 23, 2007
Project Member #2
Actually, you may be misunderstanding packed structures. I'm not certain that pack prohibits structures from 
being rounded up to a certain value - it only prohibits space from being inserted in between members.

Oct 10, 2007
It was (pre-2.1) llvm-gcc bug not to handle 'pack' pragma. However, bug was for
non-darwin hosts only. You might want to check llvm-gcc TOT (or at least 2.1
release). Please fill LLVM bug if it will still fail for you.

PS: "2" is correct answer here.
Sign in to add a comment

Powered by Google Project Hosting