public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Michael White <mwhite@ftw.mot.com>
To: help-gcc-request@gnu.org
Cc: help-gcc@gnu.org
Subject: Problems with Sun4 alignment
Date: Sat, 01 Apr 2000 00:00:00 -0000	[thread overview]
Message-ID: <Pine.HPP.3.96.1000124110537.11120g-100000@fwhsm07.fwrdc.rtsg.mot.com> (raw)
Message-ID: <20000401000000.45H6LIRMRAhv2_yCroK8XjD0b4KdBW2Xhc0izwEooM0@z> (raw)

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.

             reply	other threads:[~2000-04-01  0:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-01-24  9:30 Michael White [this message]
2000-04-01  0:00 ` Michael White

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.HPP.3.96.1000124110537.11120g-100000@fwhsm07.fwrdc.rtsg.mot.com \
    --to=mwhite@ftw.mot.com \
    --cc=help-gcc-request@gnu.org \
    --cc=help-gcc@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).