comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen_leake@stephe-leake.org>
Subject: Re: optimization away of checks in 'valid
Date: Thu, 27 Sep 2012 02:00:08 -0400
Date: 2012-09-27T02:00:08-04:00	[thread overview]
Message-ID: <85mx0catuf.fsf@stephe-leake.org> (raw)
In-Reply-To: 5a0711d8-81ad-4200-9b6e-a80feffd5302@googlegroups.com

Joseph Wisniewski <wisniewski.ru@gmail.com> writes:

> Basically, the question is, if 'valid is called on an integer object,
> are there conditions under which some of the checks done by 'valid
> (range checking on an object of an integer subtype) are removed?

See ARM 13.9.2; it lists the operations that can return invalid values.

> Specifically, we had a case where C++ code was not checking the bounds
> of a integer subtype as it was passed to Ada code via a function
> parameter. 

Reading an input parameter is not in the list of operations that can
return invalid values.

"interfacing to another language" is on the list, which is what you are
doing, but I suspect that really means "calling a subprogram implemented
in another language"; ie, a subprogram with pragma Import.

Do you have pragma Export on the Ada function? That would mean reading
the input parameter _is_ interfacing to another language, and you could
complain to your compiler vendor.

-- 
-- Stephe



      parent reply	other threads:[~2012-09-27  6:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-26  1:33 optimization away of checks in 'valid Joseph Wisniewski
2012-09-26  8:35 ` Ludovic Brenta
2012-09-26 16:46   ` Jeffrey Carter
2012-09-26 12:01 ` Georg Bauhaus
2012-09-27  6:00 ` Stephen Leake [this message]
replies disabled

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