Markus Armbruster <arm...@redhat.com> writes:

> Eric Blake <ebl...@redhat.com> writes:
[...]
>> diff --git a/qapi/qapi-visit-core.c b/qapi/qapi-visit-core.c
>> index 279ea8e..c5bdca2 100644
>> --- a/qapi/qapi-visit-core.c
>> +++ b/qapi/qapi-visit-core.c
[...]
>> @@ -44,10 +44,10 @@ void visit_start_struct(Visitor *v, const char *name, 
>> void **obj,
>>
>>      if (obj) {
>>          assert(size);
>> -        assert(v->type != VISITOR_OUTPUT || *obj);
>> +        assert(!(v->type & VISITOR_OUTPUT) || *obj);
>>      }
>
> For real walks (obj != NULL):
>
> * Input visitors write *obj, and don't care for the old value.
>
> * Output visitors read *obj, and a struct can't be null.
>
> * The dealloc visitor reads *obj, but null is fine (partially
>   constructed object).
>
> * The clone visitor reads like an output visitor (except at the root)
>   and writes like an input visitor.
>
> Before the patch, we assert "if output visitor, then *obj isn't null".
>
> After the patch, we do the same for the clone visitor.  Correct, except
> at the root.  There, @obj points to qapi_clone()'s @dst, which is
> uninitialized.  I'm afraid this assertion fails if @dst happens to be
> null.

I can observe this failure in make check when I compile with
optimization.

[...]

Reply via email to