From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41513) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WMzCn-0001Wj-TR for qemu-devel@nongnu.org; Mon, 10 Mar 2014 08:21:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WMzCj-0007fJ-3Q for qemu-devel@nongnu.org; Mon, 10 Mar 2014 08:21:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52367) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WMzCi-0007f6-R5 for qemu-devel@nongnu.org; Mon, 10 Mar 2014 08:21:13 -0400 From: Markus Armbruster References: Date: Mon, 10 Mar 2014 13:21:06 +0100 In-Reply-To: (Peter Maydell's message of "Sat, 8 Mar 2014 12:39:14 +0000") Message-ID: <87txb69rd9.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] test-qapi-visit causes clang -fsanitize=undefined warning List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: QEMU Developers , Luiz Capitulino Peter Maydell 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?