From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 79100 invoked by alias); 2 Jun 2015 14:54:36 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 79082 invoked by uid 89); 2 Jun 2015 14:54:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 02 Jun 2015 14:54:34 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 13FDF2B7855; Tue, 2 Jun 2015 14:54:33 +0000 (UTC) Received: from redhat.com (ovpn-204-24.brq.redhat.com [10.40.204.24]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t52EsS4L014746 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO); Tue, 2 Jun 2015 10:54:31 -0400 Date: Tue, 02 Jun 2015 15:05:00 -0000 From: Marek Polacek To: Richard Biener , GCC Patches , Jason Merrill , Joseph Myers , rdsandiford@googlemail.com Subject: Re: [C/C++ PATCH] Implement -Wshift-overflow (PR c++/55095) Message-ID: <20150602145428.GC2756@redhat.com> References: <20150525194816.GX27320@redhat.com> <877frnchxt.fsf@googlemail.com> <87wpzmbif9.fsf@googlemail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87wpzmbif9.fsf@googlemail.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-SW-Source: 2015-06/txt/msg00212.txt.bz2 On Tue, Jun 02, 2015 at 09:53:14AM +0100, Richard Sandiford wrote: > unsigned int min_prec = (wi::min_precision (op0, SIGNED) > + TREE_INT_CST_LOW (op1)); > bool overflowed = min_prec > TYPE_PRECISION (type0); > if (overflowed && c_inhibit_evaluation_warnings == 0) > warning_at (loc, OPT_Wshift_overflow, > "result of %qE requires %u bits to represent, " > "but %qT only has %u bits", > build2_loc (loc, LSHIFT_EXPR, type0, op0, op1), > min_prec, type0, TYPE_PRECISION (type0)); > > which seems simpler than anything involving wider precision. Clearly your version is much better, so I'll use it - thanks! I'm testing a new version of the patch, will post it soon. Marek