From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49406) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0six-0005Da-UQ for qemu-devel@nongnu.org; Fri, 05 Jun 2015 10:35:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z0siq-00015D-1G for qemu-devel@nongnu.org; Fri, 05 Jun 2015 10:35:55 -0400 Sender: Paolo Bonzini Message-ID: <5571B3BE.60003@redhat.com> Date: Fri, 05 Jun 2015 16:35:42 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1433367941-119488-1-git-send-email-agraf@suse.de> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PULL 00/40] ppc patch queue 2015-06-03 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell , Alexander Graf Cc: "qemu-ppc@nongnu.org" , QEMU Developers , Michael Roth On 05/06/2015 15:33, Peter Maydell wrote: > This is applied, but can you fix the clang sanitizer warnings, > please? > > hw/ppc/spapr_drc.c:59:24: runtime error: left shift of negative value -1 > hw/ppc/spapr_drc.c:587:19: runtime error: left shift of negative value -1 > > Problem looks to be in: > #define DRC_INDEX_ID_MASK (~(~0 << DRC_INDEX_TYPE_SHIFT)) > > which is doing left shifts on a negative signed number. Speaking in general, I find that this makes code worse. If you're using ~0 you probably want the value to extend with infinite ones. Using ~0u instead of ~0ull may cause problems down the line, and ~0ul is even worse because it is not 64-bit safe. Paolo