From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 130727 invoked by alias); 13 Aug 2015 17:49:04 -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 130715 invoked by uid 89); 13 Aug 2015 17:49:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 X-HELO: resqmta-po-04v.sys.comcast.net Received: from resqmta-po-04v.sys.comcast.net (HELO resqmta-po-04v.sys.comcast.net) (96.114.154.163) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Thu, 13 Aug 2015 17:49:02 +0000 Received: from resomta-po-15v.sys.comcast.net ([96.114.154.239]) by resqmta-po-04v.sys.comcast.net with comcast id 4Hnj1r0035AAYLo01Hp0Lj; Thu, 13 Aug 2015 17:49:00 +0000 Received: from [IPv6:2001:558:6045:a4:40c6:7199:cd03:b02d] ([IPv6:2001:558:6045:a4:40c6:7199:cd03:b02d]) by resomta-po-15v.sys.comcast.net with comcast id 4Hox1r0082ztT3H01HoyMQ; Thu, 13 Aug 2015 17:48:59 +0000 Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: [Patch] sext_hwi: Avoid left shift of negative value undefined behaviour From: Mike Stump In-Reply-To: Date: Thu, 13 Aug 2015 18:01:00 -0000 Cc: Richard Sandiford , Jeff Law , Mikael Morin , Markus Trippelsdorf , gcc-patches Content-Transfer-Encoding: quoted-printable Message-Id: <01E9AA6D-9BDF-4DE5-B9EB-19D193342E77@comcast.net> References: <55C33636.7020907@sfr.fr> <55CA51C4.3050601@redhat.com> <20150812110724.GB403@x4> <55CB4B40.6040902@sfr.fr> <55CB7C0C.7030203@redhat.com> <55CB8B51.5080908@redhat.com> <21C33A3D-9976-4632-ACCC-082F2D618ED5@gmail.com> <55CB9343.6000103@redhat.com> <87k2t06zkk.fsf@googlemail.com> <2E5F6175-B03B-491D-A71A-A44A59412140@comcast.net> To: Richard Biener X-IsSubscribed: yes X-SW-Source: 2015-08/txt/msg00728.txt.bz2 On Aug 13, 2015, at 3:05 AM, Richard Biener wr= ote: > Ok, then guard the << >> with __GCC__ and do the expensive bit stuff > otherwise. Just to cater for other host compilers doing sth unsensibly > implementation defined. Ick. The guard should be specific to the implementation defined semantic o= r undefined semantic, and then when compiling with gcc, we turn it on. My = take is that when we do this, we should add the 5 or 10 other most popular = compilers to the list of how they behave so that they all do the cheap path= code as well. If the language standard were serious in this area, it woul= d specify a header file that can define the implementation defined and unde= fined semantics that are interesting for portable code. It isn=92t. If it= were, we would then just use the standard defined guards. The language standard should be improved to directly state the possible imp= lementation choices and to require the implementation to communicate to the= program which choice it made.