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 X-Received: by 10.224.42.141 with SMTP id s13mr6473718qae.3.1369320085304; Thu, 23 May 2013 07:41:25 -0700 (PDT) X-Received: by 10.50.112.105 with SMTP id ip9mr1437053igb.1.1369320085225; Thu, 23 May 2013 07:41:25 -0700 (PDT) Path: border1.nntp.dca3.giganews.com!border2.nntp.dca3.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!news-out.readnews.com!transit3.readnews.com!209.85.216.88.MISMATCH!ch1no807003qab.0!news-out.google.com!y6ni51092qax.0!nntp.google.com!ch1no807002qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 23 May 2013 07:41:24 -0700 (PDT) In-Reply-To: <96af9cd4-3368-4866-a38e-2514a0a7a54d@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ NNTP-Posting-Host: 66.126.103.122 References: <7cd707ce-ebc5-4df1-9ec3-4f99ce87a07d@googlegroups.com> <96af9cd4-3368-4866-a38e-2514a0a7a54d@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <9d131b52-1fe8-4fcb-bb99-c034cefadeee@googlegroups.com> Subject: Re: Simple loop with a strange output From: Adam Beneschan Injection-Date: Thu, 23 May 2013 14:41:25 +0000 Content-Type: text/plain; charset=ISO-8859-1 X-Original-Bytes: 2008 Xref: number.nntp.dca.giganews.com comp.lang.ada:181732 Date: 2013-05-23T07:41:24-07:00 List-Id: On Thursday, May 23, 2013 7:37:24 AM UTC-7, Adam Beneschan wrote: > On Thursday, May 23, 2013 6:53:19 AM UTC-7, Luca Cappelletti wrote: > > do you know what's happening? > Overflow. > > The largest possible value of an "integer" type on this platform is (2**31)-1. So when X hits 2**30 and then you double it, the actual value, 2**31, won't fit in an integer. If you use the right flags when compiling (I don't remember what they are), OK, if you compile with -gnato, it will do the check, and now the program will die on a Constraint_Error instead of getting into an infinite loop. -- Adam