avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Align attribute in gcc requiring alignment of 2 for X


From: Georg-Johann Lay
Subject: Re: [avr-gcc-list] Align attribute in gcc requiring alignment of 2 for Xmegas with USB.
Date: Wed, 21 Nov 2012 21:36:51 +0100
User-agent: Thunderbird 2.0.0.24 (Windows/20100228)

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]