From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 72898 invoked by alias); 4 Dec 2018 07:20:47 -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 72881 invoked by uid 89); 4 Dec 2018 07:20:47 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: =?ISO-8859-1?Q?No, score=-16.9 required=5.0 tests=BAYES_00,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=patch.=c2, H*r:0800, opened?= X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 04 Dec 2018 07:20:45 +0000 Received: from svr-orw-mbx-03.mgc.mentorg.com ([147.34.90.203]) by relay1.mentorg.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-SHA384:256) id 1gU50d-00014U-37 from Sandra_Loosemore@mentor.com ; Mon, 03 Dec 2018 23:20:43 -0800 Received: from [127.0.0.1] (147.34.91.1) by svr-orw-mbx-03.mgc.mentorg.com (147.34.90.203) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Mon, 3 Dec 2018 23:20:40 -0800 Subject: Re: [doc PATCH] document when GCC ignores attribute aligned To: Martin Sebor , Jeff Law , Gcc Patch List References: From: Sandra Loosemore Message-ID: <1b7d7cd7-065b-48bf-1693-33b69263a53e@codesourcery.com> Date: Tue, 04 Dec 2018 07:20:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-SW-Source: 2018-12/txt/msg00150.txt.bz2 On 12/3/18 8:23 PM, Martin Sebor wrote: > Last week we agreed to clarify that attribute aligned on a function > can decrease its alignment if it hasn't been previously declared > with one.  Attached is this change. > > Besides the above, I also mention that the attribute specifies > the alignment of the first instruction of the function (in case > that wasn't obvious) , and that it has no effect in the absence > of a definition. > > I wrote some tests to convince myself this actually works as > I expected.  Where it does I add those tests to the testsuite > via this patch.  Where it doesn't I opened a bug (PR 88345). > > Martin > Index: gcc/doc/extend.texi > =================================================================== > --- gcc/doc/extend.texi (revision 266766) > +++ gcc/doc/extend.texi (working copy) > @@ -2386,16 +2386,20 @@ and may not be available on all targets. > @itemx aligned (@var{alignment}) > @cindex @code{aligned} function attribute > The @code{aligned} attribute specifies a minimum alignment for > -the function, measured in bytes. When specified, @var{alignment} must > -be an integer constant power of 2. Specifying no @var{alignment} argument > -implies the maximum alignment for the target, which is often, but by no > -means always, 8 or 16 bytes. > +the first instruction of the function, measured in bytes. When specified, > +@var{alignment} must be an integer constant power of 2. Specifying no > +@var{alignment} argument implies the ideal alignment for the target, > +which is often, but by no means always, 8 or 16 bytes. The attribute I think you might as well delete the end of the sentence starting with "which is often...". It adds words but no useful information. (Maybe it's 8 bytes, maybe it's 16 bytes, maybe it's something else....) > +has no effect when a definition for the function is not provided in > +the same translation unit. > > -You cannot use this attribute to decrease the alignment of a function, > -only to increase it. However, when you explicitly specify a function > -alignment this overrides the effect of the > -@option{-falign-functions} (@pxref{Optimize Options}) option for this > -function. > +The attribute cannot be used to decrease the alignment of a function > +previously declared with a more restrictive alignment; only to increase > +it. Attempts to do otherwise are diagnosed. Some targets specify > +a minimum default alignment for functions that is greater than 1. On > +such targets, specifying a less restrictive alignment is silently ignored. > +Using the attribute overrides the effect of the @option{-falign-functions} > +(@pxref{Optimize Options}) option for this function. > > Note that the effectiveness of @code{aligned} attributes may be > limited by inherent limitations in the system linker This patch is OK with the above nit fixed. -Sandra