comp.lang.ada
 help / color / mirror / Atom feed
* optimization away of checks in 'valid
@ 2012-09-26  1:33 Joseph Wisniewski
  2012-09-26  8:35 ` Ludovic Brenta
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Joseph Wisniewski @ 2012-09-26  1:33 UTC (permalink / raw)


Ran into an issue with one compiler having to do with the implementation of 'valid. Was looking for comments as to how other compilers handle this. 

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?

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. The Ada code _was_ checking via 'valid. 'valid returned true even though the integer value was out of bounds. Turns out the compiler relied on the "allowed assumption" that all callers "check their bounds" for such data. As such, the range checks in 'valid were eliminated as redundant as part of building with optimization on. In fact, I believe the checks were eliminated under no-opt also. 

My question is whether this is similar behavior across compilers or if 'valid is viewed as always performing the same checks, including and perhaps especiallyh bounds checks in this kind of situation.



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-10-04  1:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox