From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 108908 invoked by alias); 5 Feb 2016 16:29:35 -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 108877 invoked by uid 89); 5 Feb 2016 16:29:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=U*vogt, *node, sk:check_u, 21PM X-HELO: e06smtp15.uk.ibm.com Received: from e06smtp15.uk.ibm.com (HELO e06smtp15.uk.ibm.com) (195.75.94.111) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Fri, 05 Feb 2016 16:29:34 +0000 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 5 Feb 2016 16:29:30 -0000 Received: from d06dlp02.portsmouth.uk.ibm.com (9.149.20.14) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 5 Feb 2016 16:29:28 -0000 X-IBM-Helo: d06dlp02.portsmouth.uk.ibm.com X-IBM-MailFrom: vogt@linux.vnet.ibm.com X-IBM-RcptTo: gcc-patches@gcc.gnu.org Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 535342190056 for ; Fri, 5 Feb 2016 16:29:14 +0000 (GMT) Received: from d06av06.portsmouth.uk.ibm.com (d06av06.portsmouth.uk.ibm.com [9.149.37.217]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u15GTRcS6488540 for ; Fri, 5 Feb 2016 16:29:27 GMT Received: from d06av06.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av06.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u15GTRcV015327 for ; Fri, 5 Feb 2016 11:29:27 -0500 Received: from bl3ahm9f.de.ibm.com (sig-9-83-178-85.evts.uk.ibm.com [9.83.178.85]) by d06av06.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u15GTR8Q015307; Fri, 5 Feb 2016 11:29:27 -0500 Received: from dvogt by bl3ahm9f.de.ibm.com with local (Exim 4.76) (envelope-from ) id 1aRjG9-0001Vi-Ds; Fri, 05 Feb 2016 17:29:25 +0100 Date: Fri, 05 Feb 2016 16:29:00 -0000 From: Dominik Vogt To: gcc-patches@gcc.gnu.org Cc: Andreas Krebbel , Martin Sebor Subject: Re: [PING, PATCH] PR/68089: C++-11: Ingore "alignas(0)". Message-ID: <20160205162925.GA5405@linux.vnet.ibm.com> Reply-To: vogt@linux.vnet.ibm.com Mail-Followup-To: vogt@linux.vnet.ibm.com, gcc-patches@gcc.gnu.org, Andreas Krebbel , Martin Sebor References: <20151231115039.GA31709@linux.vnet.ibm.com> <56871F74.8060406@gmail.com> <20160104113321.GA30608@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160104113321.GA30608@linux.vnet.ibm.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16020516-0021-0000-0000-000020104B1C X-SW-Source: 2016-02/txt/msg00436.txt.bz2 Can this be approved? https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69089 On Mon, Jan 04, 2016 at 12:33:21PM +0100, Dominik Vogt wrote: > On Fri, Jan 01, 2016 at 05:53:08PM -0700, Martin Sebor wrote: > > On 12/31/2015 04:50 AM, Dominik Vogt wrote: > > >The attached patch fixes C++-11 handling of "alignas(0)" which > > >should be ignored but currently generates an error message. A > > >test case is included; the patch has been tested on S390x. Since > > >it's a language issue it should be independent of the backend > > >used. > > > > The patch doesn't handle value-dependent expressions(*). > > > It > > seems that the problem is in handle_aligned_attribute() calling > > check_user_alignment() with the second argument (ALLOW_ZERO) > > set to false. Calling it with true fixes the problem and handles > > value-dependent expressions (I haven't done any more testing beyond > > that). > > Like the attached patch? (Passes the testsuite on s390x.) > > But wouldn't an "aligned" attribute be added, allowing the backend > to possibly generate an error or a warning? > gcc/c-family/ChangeLog > > PR/69089 > * c-common.c (handle_aligned_attribute): Allow 0 as an argument to the > "aligned" attribute. > > gcc/testsuite/ChangeLog > > PR/69089 > * g++.dg/cpp0x/alignas5.C: New test. > >From 2461293b9070da74950fd0ae055d1239cc69ce67 Mon Sep 17 00:00:00 2001 > From: Dominik Vogt > Date: Wed, 30 Dec 2015 15:08:52 +0100 > Subject: [PATCH] C++-11: Ingore "alignas(0)" instead of generating an > error message. > > This is required by the C++-11 standard. > --- > gcc/c-family/c-common.c | 2 +- > gcc/testsuite/g++.dg/cpp0x/alignas5.C | 29 +++++++++++++++++++++++++++++ > 2 files changed, 30 insertions(+), 1 deletion(-) > create mode 100644 gcc/testsuite/g++.dg/cpp0x/alignas5.C > > diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c > index 653d1dc..9eb25a9 100644 > --- a/gcc/c-family/c-common.c > +++ b/gcc/c-family/c-common.c > @@ -7804,7 +7804,7 @@ handle_aligned_attribute (tree *node, tree ARG_UNUSED (name), tree args, > else if (TYPE_P (*node)) > type = node, is_type = 1; > > - if ((i = check_user_alignment (align_expr, false)) == -1 > + if ((i = check_user_alignment (align_expr, true)) == -1 > || !check_cxx_fundamental_alignment_constraints (*node, i, flags)) > *no_add_attrs = true; > else if (is_type) > diff --git a/gcc/testsuite/g++.dg/cpp0x/alignas5.C b/gcc/testsuite/g++.dg/cpp0x/alignas5.C > new file mode 100644 > index 0000000..f3252a9 > --- /dev/null > +++ b/gcc/testsuite/g++.dg/cpp0x/alignas5.C > @@ -0,0 +1,29 @@ > +// PR c++/69089 > +// { dg-do compile { target c++11 } } > +// { dg-options "-Wno-attributes" } > + > +alignas (0) int valid1; > +alignas (1 - 1) int valid2; > +struct Tvalid > +{ > + alignas (0) int i; > + alignas (2 * 0) int j; > +}; > + > +alignas (-1) int invalid1; /* { dg-error "not a positive power of 2" } */ > +alignas (1 - 2) int invalid2; /* { dg-error "not a positive power of 2" } */ > +struct Tinvalid > +{ > + alignas (-1) int i; /* { dg-error "not a positive power of 2" } */ > + alignas (2 * 0 - 1) int j; /* { dg-error "not a positive power of 2" } */ > +}; > + > +template struct TNvalid1 { alignas (N) int i; }; > +TNvalid1<0> SNvalid1; > +template struct TNvalid2 { alignas (N) int i; }; > +TNvalid2<1 - 1> SNvalid2; > + > +template struct TNinvalid1 { alignas (N) int i; }; /* { dg-error "not a positive power of 2" } */ > +TNinvalid1<-1> SNinvalid1; > +template struct TNinvalid2 { alignas (N) int i; }; /* { dg-error "not a positive power of 2" } */ > +TNinvalid2<1 - 2> SNinvalid2; > -- > 2.3.0 > Ciao Dominik ^_^ ^_^ -- Dominik Vogt IBM Germany