This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Need someone to look at a regression


> It's a pity that the code below doesn't work.
> 
> typedef struct 
> {
>   unsigned x, y;
> } foo __attribute__((mode (DF)));
> 
> foo bar()
> {
>   foo x;
>   x.x = 0;
>   x.y = 0;
>   return x;
> }
> 
> test.c: In function `bar':
> test.c:9: request for member `x' in something not a structure or union
> test.c:10: request for member `y' in something not a structure or union
> 
> This would be an extremely useful way of breaking down a floating point 
> number into its component bit-fields, without having to mess around with a 
> union.  It would certainly solve a problem I have at the moment, 
> especially if the struct were passed to and from calls in the same way as 
> a DFmode type.

You can use the 'transparent union' attribute for that.  The floating
point member of the union has to be the first one.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]