comp.lang.ada
 help / color / mirror / Atom feed
From: Shark8 <onewingedshark@gmail.com>
Subject: Re: GNAT "alignment value must be positive"
Date: Mon, 6 Apr 2015 13:48:17 -0700 (PDT)
Date: 2015-04-06T13:48:17-07:00	[thread overview]
Message-ID: <ec7fcefe-fd98-4b09-8467-b8a9a0b70b17@googlegroups.com> (raw)
In-Reply-To: <0817bf94-0550-40c4-ba5f-f2ecd6383dbb@googlegroups.com>

It's because "alignment 0" corresponds to an internal divide-by-zero error.
The LRM (13.4) gives the definition of the alignment portion of record-specification as:

      alignment_clause ::= at mod static_simple_expression;

So, "mod 0" is obviously erroneous in that case... however, that is the special case of records; in-general what we want is found in 13.3 which says, in part:

22/2  For a prefix X that denotes an object: 
23/2  X'Alignment
      The value of this attribute is of type universal_integer, and nonnegative; zero means that the object is not necessarily aligned on a storage element boundary. If X'Alignment is not zero, then X is aligned on a storage unit boundary and X'Address is an integral multiple of X'Alignment (that is, the Address modulo the Alignment is zero).

So, here the 0-alignment means that there is no imposed alignment WRT storage-element boundaries.

-----------

All that said, it could be a bug where GNAT treats an aspect differently than the corresponding representation-clause/pragma.

  reply	other threads:[~2015-04-06 20:48 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 [this message]
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
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