comp.lang.ada
 help / color / mirror / Atom feed
From: prichtmyer@yahoo.com (Peter Richtmyer)
Subject: Re: Non byte-aligned components in GNAT rejected
Date: 12 Dec 2002 10:25:13 -0800
Date: 2002-12-12T18:25:13+00:00	[thread overview]
Message-ID: <1b585154.0212121025.5956cad1@posting.google.com> (raw)
In-Reply-To: 254c16a.0212111032.451cab61@posting.google.com

mcq95@earthlink.net (Marc A. Criley) wrote in message news:<254c16a.0212111032.451cab61@posting.google.com>...
> (This is one of those situations where I wish I had the scratch to be an ACT
> supported customer.)
> 
This is one of those (rare) situations where I am diappointed in Gnat.
Rational had no problems with the package. 
> 
> GNAT 3.14p on W2K is rejecting one of my rep specs, stating that "large
> component must be on byte boundary".
> 
Using Gnat 3.15p I had the same error you did.
I found a work-around that might be acceptable to you:

package NBA is

   type VMF_Character is new Character range
     Character'Val(0) .. Character'Val(127);
   for VMF_Character'Size use 7;

   type Unit_Name_Type is array (1..64) of VMF_Character;
   for Unit_Name_Type'Component_Size use 7;
   for Unit_Name_Type'Size use 448;

   type un_t is                          -- new
      record                             -- new
         un : Unit_Name_Type;            -- new
      end record;                        -- new
   -- for un_t'size use 448;             -- bad results!


   type Unit_Group_Type is record
      B : Boolean;
      -- Unit_Name : Unit_Name_Type;     -- deleted
      Unit_Name : un_t;                  -- new
   end record;
   for Unit_Group_Type use record
      B      at 0 range 0 .. 0;
      Unit_Name at 0 range 1 .. 448; -- This is OK now
   end record;

end NBA;

As you can see, the Unit_Name is still one variable,
using th same type definition, but is now a record 
within the record.

One odd thing, if you compile with the line that has
the "bad results!" comment, you will get the same old
Gnat error! Seems like strange behavior to me.

good luck,
Peter



  parent reply	other threads:[~2002-12-12 18:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-11 18:32 Non byte-aligned components in GNAT rejected Marc A. Criley
2002-12-11 19:28 ` Stephen Leake
2002-12-12 13:41 ` Marin David Condic
2002-12-12 18:25 ` Peter Richtmyer [this message]
2002-12-13 12:39   ` Marc A. Criley
2002-12-13 19:13     ` Peter Richtmyer
2002-12-16 15:51 ` Mark Johnson
  -- strict thread matches above, loose matches on Subject: below --
2002-12-12  7:05 Grein, Christoph
replies disabled

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