Bug 28679 - #pragma pack(push) malformed
Summary: #pragma pack(push) malformed
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 3.4.4
: P3 normal
Target Milestone: 4.0.0
Assignee: Not yet assigned to anyone
Depends on:
Reported: 2006-08-10 12:46 UTC by Chris Bowler
Modified: 2006-08-16 12:47 UTC (History)
1 user (show)

See Also:
Known to work: 4.0.0 4.1.0 4.2.0
Known to fail: 3.4.0 3.3.3 3.2.3 3.0.4 2.95.3
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
Description Chris Bowler 2006-08-10 12:46:15 UTC
5.47.6 Structure-Packing Pragmas

3. #pragma pack(push[,n]) pushes the current alignment setting on an internal stack and then optionally sets the new alignment.

#pragma pack(1)
#pragma pack(push)

gcc t.c
t.c:2: warning: malformed '#pragma pack(push[, id], <n>)' - ignored

It appears #pragma pack(push) is not supported as the documention suggests.  

Also, the error message indicates there is an undocumented form or #pragma pack that takes a stack identifier.  I've been poking around to understand how it works but I'm not sure what #pragma pack(pop) does.  It appears to pop all stacks, but what packing is set afterwards if multiple stacks are popped?
Comment 1 Andrew Pinski 2006-08-16 05:32:45 UTC
Fixed in 4.0.0 and this is not a regression and 3.4.x is no longer being updated.
Comment 2 Chris Bowler 2006-08-16 12:47:48 UTC
While fixed in 4.0.0, the manual does not document the form of pragma pack with stack identifiers.