public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: "cris" <chitty@libero.it>
To: help-gcc@gnu.org
Subject: ALIGNMENT / going crazy with gcc-2.7.2-sparc-sun-sunos-4.1.3
Date: Fri, 17 Dec 1999 14:24:00 -0000	[thread overview]
Message-ID: <83earg$bgg$1@nslave1.tin.it> (raw)

hi!

how can i tell gcc to compile my programs using strict-alignment for data
types?
if i write smth like this:

    void *full_array = malloc(50);
    short *short_p = &(( (char*) full_array)[ N ]);

    printf("%hd\n",*short_p);

if N is odd, i get a core dump!

i'm using gcc 2.7.2 on an old sparc2 with SunOs 4.1.3, no way to upgrade the
os or to get a newer build of gcc.

i've searched in the doc., i've found -m switches regarding alignment for
ibm machines, but none for sparc ones!

i've also seen a SHORT_ALIGNMENT macro to be defined (gcc-info, "You can
control compilation driver"), but i don't know WHERE to define it!

please help, reply by email too!

have a nice day :)

WARNING: multiple messages have this Message-ID
From: "cris" <chitty@libero.it>
To: help-gcc@gnu.org
Subject: ALIGNMENT / going crazy with gcc-2.7.2-sparc-sun-sunos-4.1.3
Date: Fri, 31 Dec 1999 22:24:00 -0000	[thread overview]
Message-ID: <83earg$bgg$1@nslave1.tin.it> (raw)
Message-ID: <19991231222400.7NXM2G_b_9u88F8SlkYFoTK_owtwRSF0Icjuf5vLocs@z> (raw)

hi!

how can i tell gcc to compile my programs using strict-alignment for data
types?
if i write smth like this:

    void *full_array = malloc(50);
    short *short_p = &(( (char*) full_array)[ N ]);

    printf("%hd\n",*short_p);

if N is odd, i get a core dump!

i'm using gcc 2.7.2 on an old sparc2 with SunOs 4.1.3, no way to upgrade the
os or to get a newer build of gcc.

i've searched in the doc., i've found -m switches regarding alignment for
ibm machines, but none for sparc ones!

i've also seen a SHORT_ALIGNMENT macro to be defined (gcc-info, "You can
control compilation driver"), but i don't know WHERE to define it!

please help, reply by email too!

have a nice day :)

             reply	other threads:[~1999-12-17 14:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-12-17 14:24 cris [this message]
1999-12-17 15:54 ` Mike Albaugh
1999-12-31 22:24   ` Mike Albaugh
1999-12-31 22:24 ` cris

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='83earg$bgg$1@nslave1.tin.it' \
    --to=chitty@libero.it \
    --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).