[parisc-linux] Usage of __attribute__?

John David Anglin dave@hiauly1.hia.nrc.ca
Sat, 27 Jan 2001 11:39:25 -0500 (EST)


John,

I think you should forward this question to gcc@gcc.gnu.org.

> As part of my effort to fix the alignment problems in libpthread, I am
> creating a type with the aligned attribute. However, I discovered
> something strange, which I don't know if it is a bug, or is the expected
> behaviour (i.e. I am doing something wrong/don't understand how
> __attribute__ works).
> 
> If I directly declare the type as follows:
> 
>     typedef int _lt_spinlock_t __attribute__((aligned(16)));
> 
> then EVERY int that follows has the aligned 16 attribute, e.g. just
> declaring "int tmp;" gives tmp a 16 byte alignment. So, is that what
> you would expect from my above declaration?
> 
> I worked around the problem by declaring the type in two steps:
> 
>     typedef int _spin16;
>     typedef _spin16 _lt_spinlock_t __attribute__((aligned(16)));
> 
> Is there a way of combining the above two into one declaration,
> without having the undesired side effect of making every int
> aligned to a 16 byte boundary?
> 
> John Marvin
> jsm@fc.hp.com
> 
> 
> ---------------------------------------------------------------------------
> To unsubscribe: send e-mail to parisc-linux-request@thepuffingroup.com with
> `unsubscribe' as the subject.
> 
> 


-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)