[Piglit] [PATCH] ext_unpack_subimage: Ensure piglit_probe_pixel_rgba is checked.
Matt Turner
mattst88 at gmail.com
Fri Aug 8 08:32:43 PDT 2014
On Thu, Aug 7, 2014 at 10:39 PM, Vinson Lee <vlee at freedesktop.org> wrote:
> On Wed, Aug 6, 2014 at 7:49 PM, Matt Turner <mattst88 at gmail.com> wrote:
>> On Wed, Aug 6, 2014 at 5:32 PM, Vinson Lee <vlee at freedesktop.org> wrote:
>>> Fixes Coverity "Unchecked return value" defects.
>>>
>>> Signed-off-by: Vinson Lee <vlee at freedesktop.org>
>>> ---
>>> .../spec/ext_unpack_subimage/ext_unpack_subimage.c | 24 +++++++++++-----------
>>> 1 file changed, 12 insertions(+), 12 deletions(-)
>>>
>>> diff --git a/tests/spec/ext_unpack_subimage/ext_unpack_subimage.c b/tests/spec/ext_unpack_subimage/ext_unpack_subimage.c
>>> index e65f4be..3935d92 100644
>>> --- a/tests/spec/ext_unpack_subimage/ext_unpack_subimage.c
>>> +++ b/tests/spec/ext_unpack_subimage/ext_unpack_subimage.c
>>> @@ -156,19 +156,19 @@ piglit_display(void)
>>> 0, 0, 1, 1);
>>>
>>> if (extension_supported) {
>>> - pass &= piglit_probe_pixel_rgba(piglit_width / 2,
>>> - piglit_height / 4,
>>> - blue);
>>> - pass &= piglit_probe_pixel_rgba(piglit_width / 2,
>>> - piglit_height * 3 / 4,
>>> - cyan);
>>> + pass = piglit_probe_pixel_rgba(piglit_width / 2,
>>> + piglit_height / 4,
>>> + blue) && pass;
>>> + pass = piglit_probe_pixel_rgba(piglit_width / 2,
>>> + piglit_height * 3 / 4,
>>> + cyan) && pass;
>>
>> This is a fine change on its own, but can someone confirm my thinking
>> that this Coverity defect is just stupid?
>>
>> How is
>>
>> pass = pass & func();
>>
>> not checking the function return?
>
> If pass is false, then func() is not necessarily evaluated.
No, bit-wise operators don't short-circuit.
More information about the Piglit
mailing list