comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon.j.wright@mac.com>
Subject: Re: Misaligned address error
Date: Fri, 07 Sep 2007 22:49:26 +0100
Date: 2007-09-07T22:49:26+01:00	[thread overview]
Message-ID: <m2bqcecfix.fsf@mac.com> (raw)
In-Reply-To: 1189199157.591747.278390@r34g2000hsd.googlegroups.com

shaunpatterson@gmail.com writes:

> i'm working with some really old legacy code that seemed to be
> working fine with gnat pro 3.16a1.  However, we decided to upgrade
> to gnat 5.

Not GNAT 6?

> Everything built fine - however, I'm getting a misaligned address
> value error at runtime:
>
> raised PROGRAM_ERROR : data_reader.2.ada:109 misaligned address
> value
>
>   Data_String : Data_Type_Array (1 .. 8) := (others => Data_Type
> (Ascii.Nul));
>   for Data_String'Alignment use 4;

>   Eight_Byte_Float : Long_Float_Type;
>   for Eight_Byte_Float'Address use Data_String'Address;  --- FAILS ON
> THIS LINE ---

I would guess that Eight_Byte_Float'Alignment needs to be 8 on your
machine? As I remember, a PowerPC has a maximum alignment requirement
of 4, an x86 8.

You could try saying

  for Data_String'Alignment use Long_Float_Type'Alignment;

if the compiler will let you. Other than that, there is an attribute
(possibly GNAT-special) which tells you the maximum alignment required
by the processor.



  parent reply	other threads:[~2007-09-07 21:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-07 21:05 Misaligned address error shaunpatterson
2007-09-07 21:41 ` Adam Beneschan
2007-09-07 21:49 ` Simon Wright [this message]
2007-09-07 22:52   ` Simon Wright
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox