comp.lang.ada
 help / color / mirror / Atom feed
From: Laurent <daemon2@internet.lu>
Subject: Re: Bug or feature?
Date: Wed, 14 May 2014 14:24:57 -0700 (PDT)
Date: 2014-05-14T14:24:57-07:00	[thread overview]
Message-ID: <224148c3-2a31-4f3e-a3a3-0a588773798b@googlegroups.com> (raw)
In-Reply-To: <049c868a-e930-4e5d-a96a-611542cd1ce6@googlegroups.com>

Hi

Using GNAT and GPS. Didn't change anything on the compiler flags.

>When you ran the small test program, what value did you put in for N?

I used 10.

This one I didn't see: 5*2_000_000_000 = 1_410_065_408
So there is also an overflow. Didn't count the digits before. (Is there a way to add '_' to separate
the thousands automatically in GPS?)

Seems this behavior happens only with functions.

Yeah my test is quite cheap. Was more to see if I coded something strange together or if it is an other problem.

Modified my little test with Result:= 2_000_000_000 + 2_000_000_000;
Doesn't compile:

/Volumes/Kingston/GPS/Chapter 14/buffer_overflow.adb
        11:27 static expression fails Constraint_Check
        11:27 value not in range of type "Standard.Integer"

So it is a bug?  Or just a matter of putting an additional flag?

Checked the Stack Overflow check (-gnato) under Project Properties/Switches/Ada and disabling my own overflow detection the fibonacci program(iteration or recursion) crashes with Constraint Error. The behavior I expected. I am a bit disappointed/afraid of this. Or perhaps I have forgotten to read the small printed text somewhere at the end :)

Thanks

Laurent

  reply	other threads:[~2014-05-14 21:24 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-14 19:06 Bug or feature? Laurent
2014-05-14 19:57 ` Adam Beneschan
2014-05-14 20:15   ` Adam Beneschan
2014-05-14 21:24     ` Laurent [this message]
2014-05-14 21:37       ` Adam Beneschan
2014-05-14 22:02         ` Robert A Duff
2014-05-14 22:25           ` Adam Beneschan
2014-05-14 21:42       ` Robert A Duff
2014-05-15  8:51         ` Georg Bauhaus
2014-05-14 21:48       ` Randy Brukardt
2014-05-14 22:35         ` Robert A Duff
2014-05-15  8:23           ` Simon Wright
2014-05-15 18:21             ` Randy Brukardt
2014-05-15  8:58         ` Georg Bauhaus
2014-05-15 18:30           ` Randy Brukardt
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox