From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8613 invoked by alias); 24 May 2017 19:12:20 -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 8532 invoked by uid 89); 24 May 2017 19:12:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.9 required=5.0 tests=BAYES_00,GIT_PATCH_2,GIT_PATCH_3,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=08pm, 08PM 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 ESMTP; Wed, 24 May 2017 19:12:17 +0000 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5F6EF80C2B; Wed, 24 May 2017 19:12:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 5F6EF80C2B Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jakub@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 5F6EF80C2B Received: from tucnak.zalov.cz (unknown [10.36.118.76]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0792D1710F; Wed, 24 May 2017 19:12:18 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id v4OJCG3G019359; Wed, 24 May 2017 21:12:16 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id v4OJCFLO019358; Wed, 24 May 2017 21:12:15 +0200 Date: Wed, 24 May 2017 19:13:00 -0000 From: Jakub Jelinek To: Jason Merrill Cc: Andreas Schwab , gcc-patches List Subject: Re: C++ PATCH to add __integer_pack built-in for std::make_integer_sequence (c++/80396) Message-ID: <20170524191215.GP8499@tucnak> Reply-To: Jakub Jelinek References: <20170524150823.GK8499@tucnak> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.7.1 (2016-10-04) X-IsSubscribed: yes X-SW-Source: 2017-05/txt/msg01900.txt.bz2 On Wed, May 24, 2017 at 02:47:08PM -0400, Jason Merrill wrote: > On Wed, May 24, 2017 at 11:08 AM, Jakub Jelinek wrote: > > On Wed, May 24, 2017 at 04:16:30PM +0200, Andreas Schwab wrote: > >> FAIL: g++.dg/ext/integer-pack2.C -std=gnu++11 (test for excess errors) > >> Excess errors: > >> /daten/aranym/gcc/gcc-20170524/gcc/testsuite/g++.dg/ext/integer-pack2.C:10:48: error: overflow in constant expression [-fpermissive] > >> /daten/aranym/gcc/gcc-20170524/gcc/testsuite/g++.dg/ext/integer-pack2.C:10:48: error: overflow in constant expression [-fpermissive] > > > > To be precise, it fails only on 32-bit targets. > > > If we at that point want some wider integer that when cast to int > > is 0 (or small enough positive number?), shall we use something like > > this, or say 1LL << (sizeof (int) * __CHAR_BIT__), or 2LL * INT_MIN, > > something else? > > This is fine. > > > Do we need to include ? Or can we replace > > INT_MAX with __INT_MAX__? > > __INT_MAX__ sounds good. > > > Not sure about that -2147483650 for 16-bit int targets (perhaps the test can > > be guarded with int32 effective target). > > Yes, restricting the test to int32 seems like the easiest fix. Ok, I've committed this (also add something to avoid failing on hypothetical 64-bit int 64-bit long long target). Tested for both -m32 and -m64 on x86_64-linux. 2017-05-24 Jakub Jelinek * g++.dg/ext/integer-pack2.C: Require int32 effective target. Don't include limits.h. (w): Conditionalize on long long wider than int. Use 1LL << (__SIZEOF_INT__ * __CHAR_BIT__) instead of -9223372036854775808. (x): Use __INT_MAX__ instead of INT_MAX. --- gcc/testsuite/g++.dg/ext/integer-pack2.C.jj 2017-05-24 11:59:01.000000000 +0200 +++ gcc/testsuite/g++.dg/ext/integer-pack2.C 2017-05-24 21:07:02.000000000 +0200 @@ -1,12 +1,12 @@ -// { dg-do compile { target c++11 } } +// { dg-do compile { target { c++11 && int32 } } } // { dg-options -w } -#include - template struct integer_sequence { }; template using make_integer_sequence = integer_sequence; // { dg-error "argument" } -make_integer_sequence w; -make_integer_sequence x; // { dg-message "required" } +#if __SIZEOF_LONG_LONG__ > __SIZEOF_INT__ +make_integer_sequence w; +#endif +make_integer_sequence x; // { dg-message "required" } make_integer_sequence y; // { dg-message "required" } Jakub