Issue Details (XML | Word | Printable)

Key: PCC-53
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Critical Critical
Assignee: Anders Magnusson
Reporter: Reinoud Zandijk
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.

a packed union is treated as a struct

Created: 14/May/09 01:21 PM   Updated: 21/May/09 04:08 PM
Component/s: C frontend
Affects Version/s: None
Fix Version/s: None

Environment: NetBSD with pcc d.d. 13 may 2009 from CVS

 Description  « Hide
When (accidentally) declaring a packed union i.e. with:

union {
 int a;
 float b;
} _Pragma("packed 1") abc;

or equivalent, it gets treated as a struct; the offset of `a' is zero but the offset of 'b' is NOT, its 4 ! This results in various hard to track down errors.

When the _Pragma() is removed, the compilation goes OK.

 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Anders Magnusson added a comment - 21/May/09 04:08 PM
It was caused by erroneous handling of the offset recalculation in the gcc compat code.