From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!gandalf.srv.welterde.de!news.jacob-sparre.dk!loke.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: GNAT "alignment value must be positive" Date: Wed, 8 Apr 2015 15:18:45 -0500 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <0817bf94-0550-40c4-ba5f-f2ecd6383dbb@googlegroups.com> NNTP-Posting-Host: rrsoftware.com X-Trace: loke.gir.dk 1428524325 29034 24.196.82.226 (8 Apr 2015 20:18:45 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Wed, 8 Apr 2015 20:18:45 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Xref: news.eternal-september.org comp.lang.ada:25473 Date: 2015-04-08T15:18:45-05:00 List-Id: "Jeffrey Carter" wrote in message news:mg18lb$r36$1@dont-email.me... ... > However, note also the additional requirements for a composite type: "If > an > Alignment is specified for a composite subtype or object, this Alignment > shall > be equal to the least common multiple of any specified Alignments of the > subcomponent subtypes, or an integer multiple thereof." If your record has > components with specified non-zero alignment, then the alignment of the > record > must be non-zero. This requirement is nonsense and was deleted from the language for Ada 2005. And few compilers ever enforced it (Janus/Ada did, but GNAT did not, so far as I know). It probably would have been deleted sooner had I asked about it rather than just implementing it as the rule. The intent is that any "inherited" properties can always be overridden by a explicitly specified property. ... > 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 don't think Janus/Ada allows specifying zero, but that makes some sense as no stand-alone object could ever be allocated at a non-byte-aligned address. Nor would that ever happen for a component in the absence of some other representation item. So there is nothing that could actually be aligned as "zero". Perhaps GNAT is making the same assumption. 0 is defined as a possible alignment so that the alignment of a bit-mapped component is meaningful (we can't have 'Alignment not meaning anything). But I don't know of any reason to specify the alignment as zero, everything is always byte allocated by default. There might be some machine on which it makes sense to not byte align by default, but I haven't encountered it to date. Randy.