comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: What is the warning about builtin-function on gcc-4.6.0 ?
Date: Mon, 28 Mar 2011 21:20:08 -0500
Date: 2011-03-28T21:20:08-05:00	[thread overview]
Message-ID: <imrfku$1r0$1@munin.nbi.dk> (raw)
In-Reply-To: wccsju8fptr.fsf@shell01.TheWorld.com

"Robert A Duff" <bobduff@shell01.TheWorld.com> wrote in message 
news:wccsju8fptr.fsf@shell01.TheWorld.com...
> Florian Weimer <fw@deneb.enyo.de> writes:
>
>> * Robert A. Duff:
>>
>>> Florian Weimer <fw@deneb.enyo.de> 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.







  reply	other threads:[~2011-03-29  2:20 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-26  6:32 What is the warning about builtin-function on gcc-4.6.0 ? ytomino
2011-03-26  8:45 ` Florian Weimer
2011-03-26  9:13   ` ytomino
2011-03-26  9:43     ` Florian Weimer
2011-03-26 10:07       ` ytomino
2011-03-26 10:24         ` Florian Weimer
2011-03-26 15:14           ` Dmitry A. Kazakov
2011-03-26 21:36             ` ytomino
2011-03-27  9:50               ` Dmitry A. Kazakov
2011-03-26 14:50         ` Simon Wright
2011-03-26 15:50           ` Florian Weimer
2011-03-26 16:32             ` Simon Wright
2011-03-26 17:02               ` Florian Weimer
2011-03-26 17:48                 ` Simon Wright
2011-03-26 18:48                   ` Florian Weimer
2011-03-27  2:08                 ` Randy Brukardt
2011-03-27  8:37                   ` Florian Weimer
2011-03-27 16:41                     ` Robert A Duff
2011-03-27 17:21                       ` Florian Weimer
2011-03-27 17:56                         ` Robert A Duff
2011-03-27 16:51                     ` Robert A Duff
2011-03-27 17:05                       ` Florian Weimer
2011-03-27 17:14                         ` Robert A Duff
2011-03-29  2:20                           ` Randy Brukardt [this message]
2011-03-29 18:35                             ` Robert A Duff
2011-03-29 23:35                               ` Randy Brukardt
2011-03-30  1:02                               ` Adam Beneschan
2011-03-30 12:57                                 ` Robert A Duff
2011-03-30 14:41                                   ` Adam Beneschan
2011-03-30 18:39                                     ` Robert A Duff
2011-03-30 19:28                                   ` Randy Brukardt
2011-03-26 21:58       ` ytomino
2011-03-26 22:00         ` Florian Weimer
2011-03-26 22:22 ` anon
2011-03-26 22:36   ` ytomino
2011-03-27 12:00     ` anon
2011-03-27 18:50       ` ytomino
2011-03-27 23:35         ` anon
2011-03-27 23:42         ` anon
replies disabled

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