From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 91212 invoked by alias); 12 Jan 2016 13:02:27 -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 91199 invoked by uid 89); 12 Jan 2016 13:02:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.0 required=5.0 tests=BAYES_20,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=int64, __CHAR_BIT__, __char_bit__, permissive-1.C 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, 12 Jan 2016 13:02:21 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 730D618B24D for ; Tue, 12 Jan 2016 13:02:20 +0000 (UTC) Received: from tucnak.zalov.cz ([10.3.113.3]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u0CD2IWl030276 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 12 Jan 2016 08:02:20 -0500 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id u0CD2HqC003014; Tue, 12 Jan 2016 14:02:17 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id u0CD2GDt003013; Tue, 12 Jan 2016 14:02:16 +0100 Date: Tue, 12 Jan 2016 13:02:00 -0000 From: Jakub Jelinek To: Marek Polacek Cc: GCC Patches , Jason Merrill Subject: Re: C++ PATCH to abate shift warnings (PR c++/68979) Message-ID: <20160112130216.GH3017@tucnak.redhat.com> Reply-To: Jakub Jelinek References: <20160112125201.GE25528@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160112125201.GE25528@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-IsSubscribed: yes X-SW-Source: 2016-01/txt/msg00711.txt.bz2 On Tue, Jan 12, 2016 at 01:52:01PM +0100, Marek Polacek wrote: > --- gcc/testsuite/g++.dg/warn/permissive-1.C > +++ gcc/testsuite/g++.dg/warn/permissive-1.C > @@ -0,0 +1,8 @@ > +// PR c++/68979 > +// { dg-do compile } > +// { dg-options "-fpermissive -Wno-shift-overflow -Wno-shift-count-overflow -Wno-shift-count-negative" } > + > +enum A { AA = -1 << 4 }; // { dg-warning "operand of shift expression" "" { target c++11 } } > +enum B { BB = 1 << -4 }; // { dg-warning "operand of shift expression" } > +enum C { CC = 1 << 100 }; // { dg-warning "operand of shift expression" } > +enum D { DD = 31 << 30 }; // { dg-warning "shift expression" "" { target c++11 } } Shouldn't this test be limited to // { dg-do compile { target int32 } } or better yet replace the 100 and 30 above with say __SIZEOF_INT__ * 4 * __CHAR_BIT__ - 4 and __SIZEOF_INT__ * __CHAR_BIT__ - 2 ? I'd guess that on say int16 targets, or int64 targets (if we have any at some point) or int128 targets this wouldn't do what you are expecting. { target int32 } is not exactly right, because it still assumes __CHAR_BIT__ == 8 and for other char sizes it could fail. Jakub