From: "Jeffrey R. Carter" <spam.not.jrcarter@acm.not.spam.org>
Subject: Re: What does -gnato do?
Date: Sun, 27 Aug 2006 01:51:47 GMT
Date: 2006-08-27T01:51:47+00:00 [thread overview]
Message-ID: <TU6Ig.931582$084.350635@attbi_s22> (raw)
In-Reply-To: <Xns982BBFF651E2pchapinsovernet@198.186.192.137>
Peter C. Chapin wrote:
>
> with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
> procedure Check is
> X : Integer := Integer'Last;
> begin
> X := X + 1;
> Put(X);
> end Check;
>
> When I build this program *without* the -gnato option I get the
> following warning:
>
> check.adb:6:11: warning: value not in range of type "Standard.Integer"
> check.adb:6:11: warning: "Constraint_Error" will be raised at run time
It's apparent that the compiler has calculated the result of the
addition in order to issue this warning. It may then have replaced the
assignment by "raise Constraint_Error;".
Make the value of X dynamic and see if -gnato makes a difference:
X : Integer := Integer'Value (Ada.Command_Line.Argument (1) );
--
Jeff Carter
"Sheriff murdered, crops burned, stores looted,
people stampeded, and cattle raped."
Blazing Saddles
35
next prev parent reply other threads:[~2006-08-27 1:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-26 22:52 What does -gnato do? Peter C. Chapin
2006-08-27 1:51 ` Jeffrey R. Carter [this message]
2006-08-27 8:55 ` Martin Krischik
2006-08-27 11:12 ` Peter C. Chapin
2006-08-28 11:49 ` Stephen Leake
2006-08-28 21:35 ` Jeffrey R. Carter
2006-09-05 23:37 ` 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