public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* ALIGNMENT/ please reply!!!
@ 1999-12-19  6:22 cris
  1999-12-31 22:24 ` cris
  2000-01-07  6:10 ` Herve Dutter
  0 siblings, 2 replies; 4+ messages in thread
From: cris @ 1999-12-19  6:22 UTC (permalink / raw)
  To: help-gcc

Guys, i really need help!

i'm reposting my first msg:


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 :)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* ALIGNMENT/ please reply!!!
  1999-12-19  6:22 ALIGNMENT/ please reply!!! cris
@ 1999-12-31 22:24 ` cris
  2000-01-07  6:10 ` Herve Dutter
  1 sibling, 0 replies; 4+ messages in thread
From: cris @ 1999-12-31 22:24 UTC (permalink / raw)
  To: help-gcc

Guys, i really need help!

i'm reposting my first msg:


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 :)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ALIGNMENT/ please reply!!!
  1999-12-19  6:22 ALIGNMENT/ please reply!!! cris
  1999-12-31 22:24 ` cris
@ 2000-01-07  6:10 ` Herve Dutter
  2000-04-01  0:00   ` Herve Dutter
  1 sibling, 1 reply; 4+ messages in thread
From: Herve Dutter @ 2000-01-07  6:10 UTC (permalink / raw)
  To: help-gcc

hi!

I can see no alignment issue in what you describe, the SPARC processor
is just not able to handle shorts with odd location.

Cheers.

cris wrote:
> 
> Guys, i really need help!
> 
> i'm reposting my first msg:
> 
> 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 :)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ALIGNMENT/ please reply!!!
  2000-01-07  6:10 ` Herve Dutter
@ 2000-04-01  0:00   ` Herve Dutter
  0 siblings, 0 replies; 4+ messages in thread
From: Herve Dutter @ 2000-04-01  0:00 UTC (permalink / raw)
  To: help-gcc

hi!

I can see no alignment issue in what you describe, the SPARC processor
is just not able to handle shorts with odd location.

Cheers.

cris wrote:
> 
> Guys, i really need help!
> 
> i'm reposting my first msg:
> 
> 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 :)

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2000-04-01  0:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-12-19  6:22 ALIGNMENT/ please reply!!! cris
1999-12-31 22:24 ` cris
2000-01-07  6:10 ` Herve Dutter
2000-04-01  0:00   ` Herve Dutter

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).