Peter Maydell <peter.mayd...@linaro.org> writes:

> I've noticed that the tests/test-qapi-visit.c code provokes the following
> complaint from clang's -fsanitize=undefined undefined-behaviour
> checker when you run 'make check':
>
> tests/test-qapi-visit.c:462:33: runtime error: member access within
> null pointer of type 'UserDefA' (aka 'struct UserDefA')
>
> which is the line
>     visit_type_bool(m, &(*obj)->boolean, "boolean", &err);
> in static void visit_type_UserDefA_fields(Visitor *m, UserDefA ** obj,
> Error **errp).
>
> It's presumably complaining because we've passed in an obj which
> points to NULL (ie *obj == NULL). The callsite in visit_type_UserDefA()
> checks for this and doesn't call the visit..fields function. The callsite
> in visit_type_UserDefFlatUnion doesn't.
>
> Unfortunately this is all autogenerated C so I'm not sure where exactly
> the bug should be fixed. Could one of you have a look at it?

My local clang doesn't complain.  May I have your clang version, exact
invocation and output?

Reply via email to