From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44529) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zujab-0005cc-Oh for qemu-devel@nongnu.org; Fri, 06 Nov 2015 11:10:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZujaX-00005l-Ho for qemu-devel@nongnu.org; Fri, 06 Nov 2015 11:10:09 -0500 Received: from mail-wi0-x22e.google.com ([2a00:1450:400c:c05::22e]:37001) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZujaX-0008WP-Ag for qemu-devel@nongnu.org; Fri, 06 Nov 2015 11:10:05 -0500 Received: by wicfv8 with SMTP id fv8so31760765wic.0 for ; Fri, 06 Nov 2015 08:10:04 -0800 (PST) Sender: Richard Henderson References: <1446825056-7989-1-git-send-email-pbonzini@redhat.com> From: Richard Henderson Message-ID: <563CD0D8.4050805@twiddle.net> Date: Fri, 6 Nov 2015 17:10:00 +0100 MIME-Version: 1.0 In-Reply-To: <1446825056-7989-1-git-send-email-pbonzini@redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] target-sparc: fix 32-bit truncation in fpackfix, avoid undefined behavior List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , qemu-devel@nongnu.org Cc: Blue Swirl , peter.maydell@linaro.org, Mark Cave-Ayland , armbru@redhat.com On 11/06/2015 04:50 PM, Paolo Bonzini wrote: > This is reported by Coverity. The algorithm description at > ftp://ftp.icm.edu.pl/packages/ggi/doc/hw/sparc/Sparc.pdf suggests > that the 32-bit parts of rs2, after the left shift, is treated > as a 64-bit integer. Bits 32 and above are used to do the > saturating truncation. > > Use a cast to unsigned in order to placate ubsan for negative > inputs, and do so in the other fpack* instructions too. > > Signed-off-by: Paolo Bonzini > --- > target-sparc/vis_helper.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) Reviewed-by: Richard Henderson r~