From patchwork Wed Nov 30 12:27:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Trippelsdorf X-Patchwork-Id: 701005 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tTKST0xZzz9t1T for ; Wed, 30 Nov 2016 23:27:52 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="JouSYamS"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=TPN9qrnCvk3p5A5Zu79IgSh2fTmomu7SmMpOk80gwS/9vzWAn43lR fDsGIxkyciOxyugPstN1EmV+QhJJi49fSFjBQ+1o4KGvg4/ntSYs4Yiy/Hjo5ItT HNzCGOz+9mwjJg5a+xkdnlr+tl1PBIfjBScXCoQi3u0WdbQJOzxXBU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=oMakVLdV1FgtXL10HhZS4yMpmrg=; b=JouSYamSwA5Ba8uNMzSI /4hqNsGezd9lvZ88aohdyNKfAFT070Zycku8ANwGhTBoxX6wMWtQBdtFDleIvpMB OinziB2sgmPt7CR4K9HumtN6HF74m5sRkpJt6p4r0Tz8E/CHLTJWYKvP+zs5j4fi Oq8kMKQGybs0fz7rkp6jSH8= Received: (qmail 26538 invoked by alias); 30 Nov 2016 12:27:43 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 26513 invoked by uid 89); 30 Nov 2016 12:27:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:667 X-HELO: mail.ud10.udmedia.de Received: from ud10.udmedia.de (HELO mail.ud10.udmedia.de) (194.117.254.50) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 30 Nov 2016 12:27:32 +0000 Received: (qmail 26886 invoked from network); 30 Nov 2016 13:27:25 +0100 Received: from ip5b405f78.dynamic.kabel-deutschland.de (HELO x4) (ud10?360p3@91.64.95.120) by mail.ud10.udmedia.de with ESMTPSA (ECDHE-RSA-AES256-SHA encrypted, authenticated); 30 Nov 2016 13:27:25 +0100 Date: Wed, 30 Nov 2016 13:27:24 +0100 From: Markus Trippelsdorf To: gcc-patches@gcc.gnu.org Subject: [PATCH committed] Fix part of PR78555 - gcc/real.c:2890:25: runtime error: left shift of negative value -125 Message-ID: <20161130122724.GC25596@x4> MIME-Version: 1.0 Content-Disposition: inline bootstrap-ubsan gcc shows: gcc/real.c:2890:25: runtime error: left shift of negative value -125 Fixed by casting to unsigned. Tested on ppc64le. Committed as obvious. PR ipa/78555 * real.c (real_hash): Add cast to avoid left shifting of negative values. diff --git a/gcc/real.c b/gcc/real.c index 66e88e2ad366..eabe22de8510 100644 --- a/gcc/real.c +++ b/gcc/real.c @@ -2887,7 +2887,7 @@ real_hash (const REAL_VALUE_TYPE *r) return h; case rvc_normal: - h |= REAL_EXP (r) << 3; + h |= (unsigned int)REAL_EXP (r) << 3; break; case rvc_nan: