From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17368 invoked by alias); 21 Jun 2017 10:32:46 -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 17310 invoked by uid 89); 21 Jun 2017 10:32:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.9 required=5.0 tests=BAYES_00,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= 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, 21 Jun 2017 10:32:44 +0000 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8F78E81127; Wed, 21 Jun 2017 10:32:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8F78E81127 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jakub@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 8F78E81127 Received: from tucnak.zalov.cz (ovpn-116-143.ams2.redhat.com [10.36.116.143]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2180B18C4D; Wed, 21 Jun 2017 10:32:40 +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 v5LAWbj2010836; Wed, 21 Jun 2017 12:32:38 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id v5LAWZG4008017; Wed, 21 Jun 2017 12:32:35 +0200 Date: Wed, 21 Jun 2017 10:32:00 -0000 From: Jakub Jelinek To: Jason Merrill , Andreas Schwab Cc: gcc-patches List Subject: Re: C++ PATCH for c++/81073, constexpr and static var in statement-expression Message-ID: <20170621103235.GO2123@tucnak> Reply-To: Jakub Jelinek References: <87injqh29l.fsf@linux-m68k.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87injqh29l.fsf@linux-m68k.org> User-Agent: Mutt/1.7.1 (2016-10-04) X-IsSubscribed: yes X-SW-Source: 2017-06/txt/msg01561.txt.bz2 On Tue, Jun 20, 2017 at 09:45:10PM +0200, Andreas Schwab wrote: > On Jun 20 2017, Jason Merrill wrote: > > > On Tue, Jun 20, 2017 at 5:40 AM, Andreas Schwab wrote: > >> FAIL: g++.dg/cpp0x/constexpr-cast.C -std=c++11 (test for errors, line 10) > >> FAIL: g++.dg/cpp0x/constexpr-cast.C -std=c++11 (test for excess errors) > >> FAIL: g++.dg/cpp0x/constexpr-cast.C -std=c++14 (test for errors, line 10) > >> FAIL: g++.dg/cpp0x/constexpr-cast.C -std=c++14 (test for excess errors) > > > > I'm not seeing this. Can you give more detail? > > http://gcc.gnu.org/ml/gcc-testresults/2017-06/msg02172.html It doesn't fail on LP64 targets, but does fail on ILP32, on x86_64-linux can be reproduced with e.g. make check-g++ RUNTESTFLAGS='--target_board=unix\{-m32,-m64\} dg.exp=constexpr-cast.C' The difference is that for LP64, 1 has different sizeof from void * and thus you get one diagnostics, while on ILP32 int has the same precision as void *. So one gets: /usr/src/gcc/gcc/testsuite/g++.dg/cpp0x/constexpr-cast.C:10:22: error: reinterpret_cast from integer to pointer /usr/src/gcc/gcc/testsuite/g++.dg/cpp0x/constexpr-cast.C:11:22: error: 'reinterpret_cast(1)' is not a constant expression /usr/src/gcc/gcc/testsuite/g++.dg/cpp0x/constexpr-cast.C:24:26: in constexpr expansion of 'f()' /usr/src/gcc/gcc/testsuite/g++.dg/cpp0x/constexpr-cast.C:24:27: error: value '4' of type 'int*' is not a constant expression compiler exited with status 1 XFAIL: g++.dg/cpp0x/constexpr-cast.C -std=c++11 bug c++/49171 (test for errors, line 8) FAIL: g++.dg/cpp0x/constexpr-cast.C -std=c++11 (test for errors, line 10) PASS: g++.dg/cpp0x/constexpr-cast.C -std=c++11 (test for errors, line 11) PASS: g++.dg/cpp0x/constexpr-cast.C -std=c++11 (test for errors, line 24) FAIL: g++.dg/cpp0x/constexpr-cast.C -std=c++11 (test for excess errors) Excess errors: /usr/src/gcc/gcc/testsuite/g++.dg/cpp0x/constexpr-cast.C:10:22: error: reinterpret_cast from integer to pointer The following patch fixes it by allowing that wording too on the line 10. Is this ok for trunk or do you have some other preference? 2017-06-21 Jakub Jelinek * g++.dg/cpp0x/constexpr-cast.C: Adjust dg-error for ILP32. --- gcc/testsuite/g++.dg/cpp0x/constexpr-cast.C.jj 2016-08-08 21:42:30.825683528 +0200 +++ gcc/testsuite/g++.dg/cpp0x/constexpr-cast.C 2017-06-21 12:30:19.425955047 +0200 @@ -7,7 +7,7 @@ int i; // The following is accepted due to bug 49171. constexpr void *q = reinterpret_cast(&i); // { dg-error "" "bug c++/49171" { xfail *-*-* } } -constexpr void *r0 = reinterpret_cast(1); // { dg-error "not a constant expression" } +constexpr void *r0 = reinterpret_cast(1); // { dg-error "not a constant expression|reinterpret_cast from integer to pointer" } constexpr void *r1 = reinterpret_cast(sizeof 'x'); // { dg-error ".reinterpret_cast\\(1\[ul\]\*\\). is not a constant expression" } template Jakub