comp.lang.ada
 help / color / mirror / Atom feed
From: marciant@earthlink.net
Subject: Re: GNAT "alignment value must be positive"
Date: Tue, 7 Apr 2015 12:45:56 -0700 (PDT)
Date: 2015-04-07T12:45:56-07:00	[thread overview]
Message-ID: <d6e806e9-3a79-4417-a4f4-7b50cb254346@googlegroups.com> (raw)
In-Reply-To: <mg18lb$r36$1@dont-email.me>

On Tuesday, April 7, 2015 at 2:47:01 PM UTC-4, Jeffrey Carter wrote:

<snip> 

> So zero should be allowed in this obsolescent form as well.
> 
> If GNAT is rejecting zero when allowed by these rules
> then it would seem to be a compiler error.

I'm linking that also.  If I do not see any better explanation here then I will write a note to AdaCore.  Also here is a "made up" package that exhibits the issue and the compilation messages that GNAT puts out
(I also did some editing after I pasted to this message and hopefully
did not mess up the code-message correspondence):

package Nonaligned_Type_Definitions is

   type Nonaligned_Record_Component_0 is range -4 .. 4;
   for  Nonaligned_Record_Component_0'size      use 4;
   for  Nonaligned_Record_Component_0'alignment use 0;

   type Nonaligned_Record_Component_2 is range -32768 .. 32767;
   for  Nonaligned_Record_Component_2'size      use 16;
   for  Nonaligned_Record_Component_2'alignment use  0;

   type Nonaligned_Record is
      record
         Component_0a : Nonaligned_Record_Component_0;
         Component_0b : Nonaligned_Record_Component_0;
         Component_2  : Nonaligned_Record_Component_2 range 0..9999;
      end record;
   for Nonaligned_Record use
      record
         at mod 0;
         --  ignoring at 0 range  0 ..  0
         Component_0a at 0 range  1 ..  4;
         --  ignoring at 0 range  5 ..  7
         Component_0b at 0 range  8 .. 11;
         --  ignoring at 0 range 12 .. 15
         Component_2  at 2 range  0 .. 15;
      end record;
   for Nonaligned_Record'size use 32;

end Nonaligned_Type_Definitions;

GNAT output:
Nonaligned_Type_Definitions.ads:5:53: alignment value must be positive
Nonaligned_Type_Definitions.ads:9:54: alignment value must be positive
Nonaligned_Type_Definitions.ads:20:17: alignment value must be positive
gnatmake: "Nonaligned_Type_Definitions.ads" compilation error


  reply	other threads:[~2015-04-07 19:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-06 20:16 GNAT "alignment value must be positive" marciant
2015-04-06 20:48 ` Shark8
2015-04-07 15:28   ` marciant
2015-04-07 15:27 ` marciant
2015-04-07 18:46   ` Jeffrey Carter
2015-04-07 19:45     ` marciant [this message]
2015-04-08 20:18     ` Randy Brukardt
  -- strict thread matches above, loose matches on Subject: below --
2015-04-08 20:35 Randy Brukardt
2015-04-09 13:28 ` marciant
2015-04-10  0:21   ` Randy Brukardt
2015-04-10 15:45     ` marciant
2015-04-10 21:18       ` Randy Brukardt
replies disabled

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