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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,ecc38b3271b36b88 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!news.in2p3.fr!in2p3.fr!news.ecp.fr!news.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: What is the warning about builtin-function on gcc-4.6.0 ? Date: Sat, 26 Mar 2011 21:08:56 -0500 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <87aagiclte.fsf@mid.deneb.enyo.de><475d10ca-5d4e-490c-9b88-e12cd3cd3faa@b13g2000prf.googlegroups.com><87d3lejjyv.fsf@mid.deneb.enyo.de><6c748f70-7e75-49b4-a467-d1d2d6b24323@w9g2000prg.googlegroups.com> <87k4flhoeg.fsf@mid.deneb.enyo.de> <8762r5hl2u.fsf@mid.deneb.enyo.de> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1301191741 4412 69.95.181.76 (27 Mar 2011 02:09:01 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Sun, 27 Mar 2011 02:09:01 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5931 Xref: g2news1.google.com comp.lang.ada:18490 Date: 2011-03-26T21:08:56-05:00 List-Id: "Florian Weimer" wrote in message news:8762r5hl2u.fsf@mid.deneb.enyo.de... ... >> If the compiler doesn't raise an exception on division by zero (it's >> allowed not to, and GNAT doesn't) it will (in this case) set the result >> to +Inf, and 'Valid will return False. > > My understanding is that an implementation must either raise > Constraint_Error, or the evaluation of an expression must result in a > valid value. Your understanding is wrong. The only real requirement on Ada math is that the resulting values are not used in a way that causes erroneous execution (and there is even an explicit hole allowing that for Unchecked_Conversion). Otherwise, using/producing an "invalid value" is allowed in almost all contexts -- but it is a bounded error so a compiler can raise an exception if it wants. Also note that "abnormal" is something different from "invalid" (only scalar objects can be invalid). Data validity is a very complex subject; you can read 13.9.1 10 times and get different impressions each time. Reading the e-mail on the various AIs on the topic (AI05-0195-1 is the most recent) and the AARM *might* help -- or might confuse further. On top of that, different implementations use different models to ensure validity without inserting more checks than necessary. Randy.