This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

Re: [PATCH] Fix tree parts of PR18041


Hi,

On Tue, 10 May 2011, Richard Guenther wrote:

> struct B {
>   unsigned bit0 : 1;
>   unsigned bit1 : 1;
> };
> 
> void
> foo (struct B *b)
> {
>   b->bit0 = b->bit0 | b->bit1;
> }
> 
> we with this patch generate
> 
>   D.2686_2 = b_1(D)->bit0;
>   D.2688_4 = b_1(D)->bit1;
>   D.2693_10 = D.2688_4 ^ D.2686_2;
>   b_1(D)->bit0 = D.2693_10;

I assume that this generates a XOR instead of an OR is a typo not a 
feature of the patch ;-)

> + struct B {
> +     unsigned bit0 : 1;
> +     unsigned bit1 : 1;
> + };
> + 
> + void
> + foo (struct B *b)
> + {
> +   b->bit0 = b->bit0 | b->bit1;
> + }
> + 
> + /* { dg-final { scan-tree-dump-not "\\\(unsigned char\\\)" "optimized" } } */

Perhaps test for only '\\\(unsigned' ?  Because I'm not sure if some 
targets don't extend to "unsigned int", after all that's the base type of 
the bitfields.


Ciao,
Michael.


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