HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- va_arg() alignment error on HP-UX 11i
Operating System - HP-UX
1825706
Members
3351
Online
109686
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- 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
01-14-2004 05:07 AM
01-14-2004 05:07 AM
I get the following warning when compiling
va_list arglist;
int status
va_start (arglist, f_ptr);
status = va_arg(arglist, int);
in 64-bit mode on 11i:
LP64 migration: Casting from loose to strict alignment: Resulting pointer may be misaligned.
The problem being I can't see why!
This does compile cleanly for char arguments, so it looks like va_arg is mistaking arglist as being single or word byte aligned, but I'm sure all is correctly setup for 8 byte (natural) alignment.
Can anyone shed any light on this? - I've seen a similar question from about a year ago on this forum, but the ansewer just explained the theory, which I'm pretty clear on.
The puzzling thing is that he error seems to be ocurring in the parameter interpretation within va_arg itself?...
Thanks in advance
Rob
va_list arglist;
int status
va_start (arglist, f_ptr);
status = va_arg(arglist, int);
in 64-bit mode on 11i:
LP64 migration: Casting from loose to strict alignment: Resulting pointer may be misaligned.
The problem being I can't see why!
This does compile cleanly for char arguments, so it looks like va_arg is mistaking arglist as being single or word byte aligned, but I'm sure all is correctly setup for 8 byte (natural) alignment.
Can anyone shed any light on this? - I've seen a similar question from about a year ago on this forum, but the ansewer just explained the theory, which I'm pretty clear on.
The puzzling thing is that he error seems to be ocurring in the parameter interpretation within va_arg itself?...
Thanks in advance
Rob
Solved! Go to Solution.
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2004 03:49 AM
01-15-2004 03:49 AM
Solution
The va_arg definition is a big macro-
================================================================================
# define va_arg(__list,__mode) \
(sizeof(__mode) > 8l ? \
(( __list = (__va__list)(void*) ((char *)__list + ((long)__list&(0x8l)) + \
(_ROUNDUP_NEXT_DWORD(sizeof(__mode))))), \
(*((__mode *) ((char *)__list - \
(_ROUNDUP_NEXT_DWORD(sizeof(__mode))))))) : \
((__list = (__va__list)(void*) ((char *)__list + sizeof(char *))), \
__is_aggregate(__mode) ? \
(*((__mode *) ((char *)__list - sizeof(char *)))): \
(*((__mode *) ((char *)__list - sizeof(__mode)))) ))
Part of that macro is a cast from char * to __mode *. When you use a __mode of int, the compiler complains about a cast from the less strictly aligned char * to the more strictly aligned int *. It is really alright because the macro code is explicitly computing a correctly aligned pointer. The compiler just can't work that out.
================================================================================
# define va_arg(__list,__mode) \
(sizeof(__mode) > 8l ? \
(( __list = (__va__list)(void*) ((char *)__list + ((long)__list&(0x8l)) + \
(_ROUNDUP_NEXT_DWORD(sizeof(__mode))))), \
(*((__mode *) ((char *)__list - \
(_ROUNDUP_NEXT_DWORD(sizeof(__mode))))))) : \
((__list = (__va__list)(void*) ((char *)__list + sizeof(char *))), \
__is_aggregate(__mode) ? \
(*((__mode *) ((char *)__list - sizeof(char *)))): \
(*((__mode *) ((char *)__list - sizeof(__mode)))) ))
Part of that macro is a cast from char * to __mode *. When you use a __mode of int, the compiler complains about a cast from the less strictly aligned char * to the more strictly aligned int *. It is really alright because the macro code is explicitly computing a correctly aligned pointer. The compiler just can't work that out.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2004 07:50 PM
01-15-2004 07:50 PM
Re: va_arg() alignment error on HP-UX 11i
Thanks Mike, that clears this up nicely.
regards
Rob
regards
Rob
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Support
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP