Re: Align attribute in gcc requiring alignment of 2 for Xmegas with USB.

Georg-Johann Lay <[email protected]>
Newsgroups gmane.comp.hardware.avr.gcc
Message-ID <[email protected]>
Hi, would you avoid TOFU style in the lists? Thanks.

Otherwise we will soon lose track of a conversation.

Thomas, George schrieb:
> Hi,
> 
> I checked the patches of the fix in PR53448
> 
> Even when the requested alignment in greater than the
> BIGGEST_ALIGNMENT (considering it to be 2 for Xmega and 1 for other
> devices), we are not producing a warning to the user that he is
> trying to align more than the required. Is this behavior right ?

Yes.

> Should the warning be there in this case ?

No.  If alignment is bigger than BIGGEST_ALIGNMENT, then code will still 
be all right; just a bit more memory consuming.

However, some hardware might need a more restrictive alignment, you 
named an example.  To arrange for that, the user can align data by hand.

This align-by-hand will be an exception and is not commonly needed for 
code that runs on xmega.

On a strict-alignment platform like ARM, you would set BIGGEST_ALIGNMENT 
to 32 or maybe even 64 for 64-bit ARMs.

If alignments are less restrictive than BIGGEST_ALIGNMENT you will get 
wrong code, e.g. for variables located in memory.  Because on AVR there 
are no restrictions, BIGGEST_ALIGNMENT is 8.

In the case where the user wants to align, say, an I/O buffer, she can 
use the alignment attribute to arrange for that exception to the rule, 
and no diagnostic should be issued then because the user explicitly 
asked to align the object.

Johann
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.