* Problems with Sun4 alignment
@ 2000-01-24 9:30 Michael White
2000-04-01 0:00 ` Michael White
0 siblings, 1 reply; 2+ messages in thread
From: Michael White @ 2000-01-24 9:30 UTC (permalink / raw)
To: help-gcc-request; +Cc: help-gcc
Hi all,
I'm having a problem with the executable generated by gcc 2.8.1 for Sun
4 (uname -a: SunOS drywall3 4.1.3_U1 2 sun4m). Specifically, I've
specified the following flags/defines in tm.h:
#define STRICT_ALIGNMENT 1
#define STRUCTURE_SIZE_BOUNDARY 32
Here's the structure I'm having problems with:
typedef struct
{
UBYTE hdr_ver:4;
UBYTE data_ver:4;
UBYTE reserved:4;
UBYTE chan_id:4;
UWORD len;
UWORD msg_type;
STD_SCAP_ADDR dest_addr;
UWORD resp_type;
XC_SCAP_ADDR src_addr;
} SCAP_HDR;
Where:
#define UBYTE unsigned char
#define UWORD unsigned short
#define ULONG unsigned long
typedef struct
{
UBYTE system;
UBYTE sub_system[2];
UBYTE group;
UBYTE device;
UBYTE element;
} STD_SCAP_ADDR;
typedef struct
{
UBYTE system;
UBYTE sub_system;
UBYTE device;
UBYTE id_1;
UBYTE id_2;
UBYTE id_3;
} XC_SCAP_ADDR;
And finally, here's the line that causes a bus fault (SIGBUS):
i = *(UWORD *)outgoing_scap_msg->scap_hdr.dest_addr.sub_system;
The value of outgoing_scap_msg is 0x3fa89c
The value of &outgoing_scap_msg->scap_hdr.dest_addr is 0x3fa8a4
The value of &outgoing_scap_msg->scap_hdr.dest_addr.sub_system 0x3fa8a5
Perhaps I'm way off base here, but it seems to me that when gcc was
built, it ignored the STRICT_ALIGNMENT define. This code works correctly
under "cc" (the native Sun4 compiler).
Any solutions would be greatly appreciated. Please email me if possible.
Thank you.
---
Michael White, qa1402@ftw.mot.com
Cellular Infrastructure Group
Ft. Worth, Texas (817)245-6418
P.S. If this is not the proper place to ask these sort of questions, my
apologies. If you happen to know the proper place, please tell me and/or
forward my email.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Problems with Sun4 alignment
2000-01-24 9:30 Problems with Sun4 alignment Michael White
@ 2000-04-01 0:00 ` Michael White
0 siblings, 0 replies; 2+ messages in thread
From: Michael White @ 2000-04-01 0:00 UTC (permalink / raw)
To: help-gcc-request; +Cc: help-gcc
Hi all,
I'm having a problem with the executable generated by gcc 2.8.1 for Sun
4 (uname -a: SunOS drywall3 4.1.3_U1 2 sun4m). Specifically, I've
specified the following flags/defines in tm.h:
#define STRICT_ALIGNMENT 1
#define STRUCTURE_SIZE_BOUNDARY 32
Here's the structure I'm having problems with:
typedef struct
{
UBYTE hdr_ver:4;
UBYTE data_ver:4;
UBYTE reserved:4;
UBYTE chan_id:4;
UWORD len;
UWORD msg_type;
STD_SCAP_ADDR dest_addr;
UWORD resp_type;
XC_SCAP_ADDR src_addr;
} SCAP_HDR;
Where:
#define UBYTE unsigned char
#define UWORD unsigned short
#define ULONG unsigned long
typedef struct
{
UBYTE system;
UBYTE sub_system[2];
UBYTE group;
UBYTE device;
UBYTE element;
} STD_SCAP_ADDR;
typedef struct
{
UBYTE system;
UBYTE sub_system;
UBYTE device;
UBYTE id_1;
UBYTE id_2;
UBYTE id_3;
} XC_SCAP_ADDR;
And finally, here's the line that causes a bus fault (SIGBUS):
i = *(UWORD *)outgoing_scap_msg->scap_hdr.dest_addr.sub_system;
The value of outgoing_scap_msg is 0x3fa89c
The value of &outgoing_scap_msg->scap_hdr.dest_addr is 0x3fa8a4
The value of &outgoing_scap_msg->scap_hdr.dest_addr.sub_system 0x3fa8a5
Perhaps I'm way off base here, but it seems to me that when gcc was
built, it ignored the STRICT_ALIGNMENT define. This code works correctly
under "cc" (the native Sun4 compiler).
Any solutions would be greatly appreciated. Please email me if possible.
Thank you.
---
Michael White, qa1402@ftw.mot.com
Cellular Infrastructure Group
Ft. Worth, Texas (817)245-6418
P.S. If this is not the proper place to ask these sort of questions, my
apologies. If you happen to know the proper place, please tell me and/or
forward my email.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2000-04-01 0:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-01-24 9:30 Problems with Sun4 alignment Michael White
2000-04-01 0:00 ` Michael White
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).