comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@gnat.com (Robert Dewar)
Subject: Re: Valid on QNaN generates exception, compiler bug?
Date: 1 Feb 2002 13:11:36 -0800
Date: 2002-02-01T21:11:38+00:00	[thread overview]
Message-ID: <5ee5b646.0202011311.393ce8d9@posting.google.com> (raw)
In-Reply-To: cYx68.6829$IZ4.21489@rwcrnsc54

"Steve Doiel" <nospam_steved94@attbi.com> wrote in message news:<cYx68.6829$IZ4.21489@rwcrnsc54>...
> Interesting.  I expected float_value'Valid to return 
> false, not raise an
> exception.

And of course your expectation was entirely correct. This
is a clear bug (some earlier version of GNAT had this bug,
and for a while we actually installed an implicit exception
handler to catch the bogus exception and return False, but
now GNAT does explicit code to test for and catch NaN's
and infinities. The problem is that a signalling NaN may
raise an exception just by loading it.

But the prefix of 'Valid is very special. As we read in
13.9.2, the ONLY way you can use an invalid value like
a NaN is in this context:

12   (20) X'Valid is not considered to be a read of X; 
     hence, it is not an
     error to check the validity of invalid data.

There is no basis whatsoever for raising a Constraint_Error
here, the program is correct, and the 'Valid attribute
should yield False. Report the bug to the relevant vendor.

You definitely do NOT need to guard all 'Valid attributes
with an exception handler (which is what the previous 
incorrect response would have implied).



  reply	other threads:[~2002-02-01 21:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-31  4:04 Valid on QNaN generates exception, compiler bug? Steve Doiel
2002-02-01 14:12 ` Stephen Leake
2002-02-01 14:51   ` Steve Doiel
2002-02-01 21:11     ` Robert Dewar [this message]
2002-02-01 22:13       ` Steve Doiel
2002-02-01 16:16   ` Jeffrey Carter
  -- strict thread matches above, loose matches on Subject: below --
2002-01-31  4:04 Steve Doiel
replies disabled

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