From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,LOTS_OF_MONEY autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b6062cca52b2d096 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-02-01 13:11:39 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: dewar@gnat.com (Robert Dewar) Newsgroups: comp.lang.ada Subject: Re: Valid on QNaN generates exception, compiler bug? Date: 1 Feb 2002 13:11:36 -0800 Organization: http://groups.google.com/ Message-ID: <5ee5b646.0202011311.393ce8d9@posting.google.com> References: NNTP-Posting-Host: 205.232.38.244 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1012597898 11353 127.0.0.1 (1 Feb 2002 21:11:38 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 1 Feb 2002 21:11:38 GMT Xref: archiver1.google.com comp.lang.ada:19506 Date: 2002-02-01T21:11:38+00:00 List-Id: "Steve Doiel" wrote in message news:... > 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).