On 08/25/2013 11:29 PM, Siddhesh Poyarekar wrote:
On Fri, Aug 23, 2013 at 11:58:21AM -0400, Carlos O'Donell wrote:
> Looks good to me.
>
> A couple of nits:
>
> (a) Could any program possibly expect `val1 - val2' to be the magnitude
> of the difference and use that information for anything meaningful?
>
> I doubt it. The standard is sufficiently vague that it shouldn't
> be a problem and I've never seen code that expects this.
Imagine two strings where the first string starts with 'a' and the
second string that has 0xffff '+' and then a 'b'. Here val1 - val2
will exceed sizeof(int32_t).
I agree that there is an overflow. My question is more along the lines
of "Could the change in behaviour, even though within the bounds of the
standard, have a detrimental impact to applications?" Our position of
safety is to say that the standard doesn't require it. Could an application
use the magnitude of the difference to do anything meaningful?
> (b) Test case? QE is going to have a hard time testing this
without one.
There's an xtest that I added to the upstream testsuite but not here
because we don't run xtests anyway. Besides that test is bound to
cause havoc on the build system so we're better off having QE run it
manually instead. I'll post the test case on the bugzilla. Does that
sound OK?
That's perfect and exactly the kind of information we want to pass on
to QE.
Cheers,
Carlos.