- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- HPUX, ia64, ILP32 and alignment issue
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-29-2010 12:27 PM
тАО03-29-2010 12:27 PM
HPUX, ia64, ILP32 and alignment issue
struct node {
void * data;
struct node * next;
struct node * prev;
};
...
struct node *nptr = malloc(sizeof(struct node) + sizeof(my_data));
nptr->data = nptr + 1;
*(uint64_t *)nptr->data = 123LLU; // bus error
This causes a bus error only on ia64 compiled in ILP32 data mode.
I can circumvent this bus error with the +u compiler option or by adding an uint64_t (or a void *) member after the 'prev' pointer.
Note I can compile this code on a plethora of other platforms and architectures without error. Only the HP ia64 + ILP32 model results in the bus error without the above mentioned workarounds.
Is this expected? Is the HP compile not accessing memory or padding structs correctly?
Note I am testing with a range of HP compiler revs (latest being 6.12).
Thanks in advance.
--Eric
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-29-2010 04:13 PM - edited тАО08-21-2011 05:35 PM
тАО03-29-2010 04:13 PM - edited тАО08-21-2011 05:35 PM
Re: HPUX, ia64, +DD32 and alignment issue
>This causes a bus error only on ia64 compiled in ILP32 data mode.
This also will abort on PA if you optimize.
Your program is doing an illegal cast. nptr is only 4 byte aligned. Your struct is only 4 byte aligned and has a size of 12. So nptr+1 is only 4 byte aligned.
But uint64_t* is 8 byte aligned, so it aborts.
You need to pad your struct to be 8 byte aligned:
struct node {
void *data;
struct node *next, *prev;
uint64_t :0; // align struct
};
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-29-2010 04:15 PM - edited тАО08-21-2011 05:35 PM
тАО03-29-2010 04:15 PM - edited тАО08-21-2011 05:35 PM
Re: HPUX, ia64, +DD32 and alignment issue
Oops, actually nptr is 16 byte aligned but nptr+1 is only 4.