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: g2news2.google.com!news4.google.com!feeder3.cambriumusenet.nl!feed.tweaknews.nl!138.195.8.3.MISMATCH!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: Mon, 28 Mar 2011 21:20:08 -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> <87vcz5ot5z.fsf@mid.deneb.enyo.de> <87sju8lcis.fsf@mid.deneb.enyo.de> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1301365215 1888 69.95.181.76 (29 Mar 2011 02:20:15 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Tue, 29 Mar 2011 02:20:15 +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: g2news2.google.com comp.lang.ada:19533 Date: 2011-03-28T21:20:08-05:00 List-Id: "Robert A Duff" wrote in message news:wccsju8fptr.fsf@shell01.TheWorld.com... > Florian Weimer writes: > >> * Robert A. Duff: >> >>> Florian Weimer writes: >>> >>>> This is at odds with the existing Ada literature, and existing ACATS >>>> tests (C45632A, for example). >>> >>> Hmm, I got curious, and looked at C45632A. It looks wrong, to me. >>> "EQUAL (ABS I, I)" should return False, or else raise C_E. >>> The test requires it to return True, or raise C_E. >>> Maybe they meant "EQUAL (ABS I, - I)". >> >> I think the equality test is just there to provide a better failure >> message. With wrap-around semantics, both abs I = I and abs I = -I >> are true. > > But "EQUAL (ABS I, I)" can return False. The test calls FAILED > (twice) if it does, so the test is wrong. Doesn't that depend on the implementation of EQUAL? It's just a function call, it doesn't necessarily have the same semantics as "=". (I think the intent is that the result is the same as "=" for valid values, but I doubt anything is guaranteed about invalid values.) The actual implementation of EQUAL is full of recursion (it's intended to be an optimization blocker), and it's hard to tell whether or not one of the inner calls would cause some other results for invalid values (such as raising Constraint_Error). And if it didn't do that, the implementor could change the function to include 'Valid on the operands to ensure that they're not invalid. >>...There's still a call to Failed further down, so this >> doesn't affect the correctness of the test. > > Ah, I missed that. But I still think the test is wrong. > > I'm not surprised nobody noticed -- I think most compilers will raise C_E. I agree that it doesn't make any sense, because the Failed message is in the wrong branch. But since it fails either way it doesn't matter in a significant way. I suspect that there are lot of tests that might fail if the rules for valid values are taken to the limit -- any test that intentionally raises an exception is always at risk for optimization problems (and that is what 13.9.1 is ultimately about). Randy.