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.ams3.giganews.com!border2.nntp.ams3.giganews.com!border2.nntp.ams2.giganews.com!border4.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!nntp.giganews.com!eternal-september.org!feeder.eternal-september.org!mx05.eternal-september.org!.POSTED!not-for-mail From: Simon Clubley Newsgroups: comp.lang.ada Subject: Re: Range check for type 'Integer' Date: Mon, 17 Jun 2013 11:23:33 +0000 (UTC) Organization: A noiseless patient Spider Message-ID: References: <7f33982d-3bcf-452e-a3b3-3a0a28505ff1@x20g2000vbe.googlegroups.com> Injection-Date: Mon, 17 Jun 2013 11:23:33 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="3a7522c45acd2a6c162b080668fa4020"; logging-data="15164"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19+p6oNuFvt2lk3mqPLRsINgAp0kn5Lpd0=" User-Agent: slrn/0.9.8.1 (VMS/Multinet) Cancel-Lock: sha1:d0EWTkLffT6wuwOwIPg6rTr6NnI= X-Original-Bytes: 1789 Xref: number.nntp.dca.giganews.com comp.lang.ada:181883 Date: 2013-06-17T11:23:33+00:00 List-Id: 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 ? Simon. -- Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP Microsoft: Bringing you 1980s technology to a 21st century world