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: border1.nntp.dca3.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!goblin2!goblin.stu.neva.ru!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx05.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Range check for type 'Integer' Date: Mon, 17 Jun 2013 12:54:02 +0100 Organization: A noiseless patient Spider Message-ID: References: <7f33982d-3bcf-452e-a3b3-3a0a28505ff1@x20g2000vbe.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx05.eternal-september.org; posting-host="b69de8604a6c4b9f4a8de618679474df"; logging-data="24816"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18X7D6pxfjjGke1cyCeFAWvzOgqXaLuc8A=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (darwin) Cancel-Lock: sha1:R4VDmu1Wzqgf37cfDXzLDrQJdGI= sha1:yegIX+tyIyS281A/a71g83ng3LI= X-Original-Bytes: 1803 Xref: number.nntp.dca.giganews.com comp.lang.ada:181884 Date: 2013-06-17T12:54:02+01:00 List-Id: Simon Clubley writes: > On 2013-06-17, Peter Brooks wrote: >> >> So the 'Integer' has rolled over to negative and then rolled back to >> 0 - but with no run-time error. >> >> Why is there no range check error on type Integer? > > Because GNAT does not enable integer overflow detection by default; > this is a design decision which was a major mistake. You need to > compile your program using the switch to enable integer overflow > detection. > > BTW, this same program was posted a few days ago with the same problem > description. Is this a problem posed as part of a class you are taking > ? And, as stated before, compile with -gnato to enable integer overflow detection.