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!.POSTED!not-for-mail From: Brian Drummond Newsgroups: comp.lang.ada Subject: Re: Compiler checking of String lengths during assignment (Newbie Question) Date: Sat, 10 Jan 2015 12:43:55 +0000 (UTC) Organization: A noiseless patient Spider Message-ID: References: <77d434cc-00bc-4a2f-b50e-40736abdd2b2@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Sat, 10 Jan 2015 12:43:55 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="da745e888d4a5182b5fda6212bbb0a63"; logging-data="30174"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/zE9dsGF68D9NyyHBSj9vvJ1hhHCp9054=" User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2) Cancel-Lock: sha1:mUvtwlXPX/dKS4M5UZM3+tiGOnw= Xref: news.eternal-september.org comp.lang.ada:24524 Date: 2015-01-10T12:43:55+00:00 List-Id: On Sat, 10 Jan 2015 00:20:11 +0100, Stefan.Lucks wrote: > On Fri, 9 Jan 2015, Simon Wright wrote: > >>> The first 2 cases produces an error during the build, as expected, >>> because Head is known to be length of 5 and I'm assigning something of >>> a different length. > > I believe, all three should generate a run-time error (most likely a > Constraint_Error). The FSF Gnat 4.9.1 (Debian package) compiles with warnings, and all three raise Constraint Error. The first one reports "length check failed", the other two "range check failed". We often hear that the FSF compiler "lags behind" the Libre one and maybe in some respects it does, but apparently, that doesn't mean it's always worse. - Brian