"aligned" attribute with too-large argument

Paul Koning paulkoning@comcast.net
Mon Oct 29 15:19:00 GMT 2018



> On Oct 29, 2018, at 10:54 AM, Martin Sebor <msebor@gmail.com> wrote:
> 
> On 10/29/2018 07:45 AM, Paul Koning wrote:
>> I noticed an inconsistency in the handling of the aligned attribute.  When applied to variables, I get an error message if the alignment is too large for the platform.  But when applied to functions, there is no error check.  The same applies to label alignment (from the -falign-labels switch).
>> 
>> The result is an ICE in my target code because it is asked to output assembly language for an alignment not supported by the target.
>> 
>> Should these cases also produce error messages?  Or should the back end ignore attempts to align too much?
> 
> check_user_alignment() in c-attribs.c rejects excessive alignments
> the same for functions and variables:
> 
> else if (i >= HOST_BITS_PER_INT - LOG2_BITS_PER_UNIT)
>   {
>     error ("requested alignment is too large");
>     return -1;
>   }
> 
> so I don't immediately see where this inconsistency comes from
> Is there different/more restrictive handling for variables in
> the back end? (a test case would be great).

I forgot to attach it.  Here it is.

	paul

-------------- next part --------------
A non-text attachment was scrubbed...
Name: testalign.c
Type: application/octet-stream
Size: 314 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20181029/14ca4de9/attachment.obj>
-------------- next part --------------




More information about the Gcc mailing list