qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] test-qapi-visit causes clang -fsanitize=undefined warning


From: Peter Maydell
Subject: [Qemu-devel] test-qapi-visit causes clang -fsanitize=undefined warning
Date: Sat, 8 Mar 2014 12:39:14 +0000

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?

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]