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!news1.google.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!news.glorb.com!news2.glorb.com!news.mv.net!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: What is the warning about builtin-function on gcc-4.6.0 ? Date: Sun, 27 Mar 2011 13:56:25 -0400 Organization: The World Public Access UNIX, Brookline, MA 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> <87vcz5ot5z.fsf@mid.deneb.enyo.de> <87r59slbrs.fsf@mid.deneb.enyo.de> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls6.std.com 1301248585 11931 192.74.137.71 (27 Mar 2011 17:56:25 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Sun, 27 Mar 2011 17:56:25 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:6UKWVCG9JTPSPIuvVLOrrBGPtwc= Xref: g2news1.google.com comp.lang.ada:18505 Date: 2011-03-27T13:56:25-04:00 List-Id: Florian Weimer writes: > * Robert A. Duff: > >> Florian Weimer writes: >> >>> I'm bothered by this reasoning because it means that Ada compilers >>> don't have to implement any overflow checks on integer arithmetic. >> >> Randy was talking about floating point. I'm not sure why the >> above follows from what Randy said, but anyway, the rules for >> integer arithmetic are: > > Okay, back one step. I can't find the language rule which allows > floating point arithmetic to produce invalid values (or objects with > invalid representation, if you will). > > Is this about 3.5.6(7/2)? > > | For the execution of a predefined operation of a real type, the > | implementation need not raise Constraint_Error if the result is > | outside the base range of the type, so long as the correct result is > | produced, or the Machine_Overflows attribute of the type is False > | (see*note G.2). > > In the typical i386 case, this simplifies to: > > | For the execution of a predefined operation of a real type, the > | implementation need not raise Constraint_Error if the result is > | outside the base range of the type. > > This means that my initial assessment that a false value for 'Valid > indicates a compiler bug was wrong. I think what you say above is correct, but I'm not an expert in floating point. I'm pretty sure the intent of Ada 95 was to allow infinities to be returned on overflow. I don't know about division by zero. >>>...(You cannot detect values which are >>> conceptually invalid by inspecting the 'Valid attribute at run time >>> because it produces false negatives, but this is a different matter.) >> >> I'm not sure what you mean. How can 'Valid produce false negatives? > > The language rules define that a certain point of execution, an object > has an invalid representation (and a compiler may assume it has). But > this might not be visible on the hardware during actual execution > because the invalid representation is, by sheer luck, valid for the > type of the object. Sorry, I still don't understand what you mean. Maybe you could give an example (preferably using integers, not floats). - Bob