comp.lang.ada
 help / color / mirror / Atom feed
From: robert_s_quinn@yahoo.com (Robert Quinn)
Subject: Is this a GNAT bug???
Date: 26 Apr 2002 09:36:17 -0700
Date: 2002-04-26T16:36:18+00:00	[thread overview]
Message-ID: <db500a4f.0204260836.340512d6@posting.google.com> (raw)

I originally posted a question regarding pragma pack, but after
stripping away all the details I found what may be a bug, or just
something I don't understand about low level programming.  I will post
it, and it is brief code, but in a nutshell an array of 64 bits packs
fine, but an array of 65 bits does not!

I will post code here that is actually compilable, unlike my last
message :)

I am using gnat3.13p on Sparc Solaris

Here is the WORKING, NO ERRORS code:

package test is
   type ONE_BIT_TYPE is range 0..1;
   for ONE_BIT_TYPE'SIZE use 1;

   type ARRAY_OF_64_BITS_TYPE is array (1..64) of ONE_BIT_TYPE;
   pragma pack (ARRAY_OF_BITS_TYPE);

   type MY_TYPE is record
      ARRAY_OF_64_BITS : ARRAY_OF_64_BITS_TYPE;
   end record;

   pragma pack (MY_TYPE);

   for MY_TYPE use record
      ARRAY_OF_64_BITS at 0 range 0..63;
   end record;

end test;

** NOW just replace 64 with 65 (and 63 with 64 on range) and Voila',
you get the error:
  "size of ARRAY_OF_65_BITS too small, minimum allowed is 72"

Here is the OFFENDING code:

package test is
   type ONE_BIT_TYPE is range 0..1;
   for ONE_BIT_TYPE'SIZE use 1;

   type ARRAY_OF_65_BITS_TYPE is array (1..65) of ONE_BIT_TYPE;
   pragma pack (ARRAY_OF_BITS_TYPE);

   type MY_TYPE is record
      ARRAY_OF_65_BITS : ARRAY_OF_65_BITS_TYPE;
   end record;

   pragma pack (MY_TYPE);

   for MY_TYPE use record
      ARRAY_OF_65_BITS at 0 range 0..64;
   end record;

end test;


So why can't I pack a bit array of 65 bits or more bits? Anyone have
any comments?



             reply	other threads:[~2002-04-26 16:36 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-26 16:36 Robert Quinn [this message]
2002-04-26 17:48 ` Is this a GNAT bug??? Mark Johnson
2002-04-26 22:20   ` Robert Dewar
2002-04-29 15:45   ` Robert Quinn
2002-04-30  2:44     ` Robert Dewar
2002-04-30 14:15       ` Larry Kilgallen
2002-04-30 16:41       ` Robert Quinn
2002-04-30 18:20         ` tmoran
2002-05-01  1:31           ` Robert Quinn
2002-05-01 17:08             ` Ted Dennison
2002-05-02  1:55               ` Larry Kilgallen
2002-05-02 14:04                 ` Mark Johnson
2002-05-02 15:25                   ` Larry Kilgallen
2002-04-30 21:55         ` Mark Johnson
2002-05-01 22:59           ` Nick Roberts
2002-05-02 13:56             ` Mark Johnson
2002-05-02 20:19               ` Nick Roberts
2002-05-02 21:55                 ` Mark Johnson
  -- strict thread matches above, loose matches on Subject: below --
2003-09-20 22:50 Is this a gnat bug? Waldek Hebisch
2003-09-20 23:09 ` Ludovic Brenta
2003-09-21  2:37 ` Waldek Hebisch
replies disabled

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