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=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,b3c479d8e293030d X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit X-FeedAbuse: http://nntpfeed.proxad.net/abuse.pl feeded by 88.191.16.109 Path: g2news2.google.com!news4.google.com!feeder1-2.proxad.net!proxad.net!feeder2-2.proxad.net!nntpfeed.proxad.net!nospam.fr.eu.org!usenet-fr.net!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Ludovic Brenta Newsgroups: comp.lang.ada Subject: Re: Unconstrained base subtype questions Date: Thu, 31 Mar 2011 23:36:36 +0200 Organization: A noiseless patient Spider Message-ID: <87wrjfkm57.fsf@ludovic-brenta.org> References: <8762qzm1ya.fsf@ludovic-brenta.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="7aJR7Z6rvBMZc2WfcNJCXQ"; logging-data="30441"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Ye4NeLUGvuADLPioFpmH5" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) Cancel-Lock: sha1:co4xCWovZibO2x08CZqXQjDy+8A= sha1:w/uwuwMCRAVfUCcfuxWBEtkoh3A= Xref: g2news2.google.com comp.lang.ada:19610 Date: 2011-03-31T23:36:36+02:00 List-Id: "Alex Mentis" writes: >> - during execution, there are two kinds of overflow checks. >> Intermediate results must lie within the "base range of the type" >> which, for all intents and purposes, is the full range of >> [[Long_]Long_]Integer (ARM 4.5.4(20)). So, if an intermediate value >> exceeds e.g. Integer'Last you get a Constraint_Error. > > Well, that's my question. In the calculation above, I clearly have an > intermediate value that exceeds Integer'Last. And I tried something > similar with Long_Long_Integer and still couldn't get an overflow > error! So what is the actual limit on the base range of the type? Is it > language defined, compiler defined, hardware defined, none of the above? It is both language- and implementation-defined. I gave you the references to what the language says. The implementation-defined part is the "base range of the type"; a sane implementation would choose a range that matches the hardware. The reason why you did not get an overflow at runtime is because your computation did not take place at run time. The GNAT warnings and Constraint_Error that I reported earlier were for the case of a run-time computation similar to what Simon and Randy said. -- Ludovic Brenta.