------- Comment #2 from xinping dot huang at gmail dot com  2010-05-24 13:51 
-------
Subject: Re:  Strange behavior on bit fields sructures.

My gcc 4.4.4 generate the correct binary and get the correct result
even with -O3 option.

Wesley

2010/5/24 dennis at conus dot info <gcc-bugzi...@gcc.gnu.org>:
>
>
> ------- Comment #1 from dennis at conus dot info  2010-05-24 13:30 -------
> The code 4.4.1 x86 generating (with -O3 option) for bswap() function I
> mentioned earlier is strange too:
>
>
> ; bswap(unsigned int)
>                public _Z5bswapj
> _Z5bswapj       proc near
>
> var_4           = dword ptr -4
> arg_0           = dword ptr  8
>
>                push    ebp
>                mov     ebp, esp
>                sub     esp, 10h
>                mov     eax, [ebp+arg_0]
>                mov     edx, eax
>                sar     edx, 18h
>                mov     byte ptr [ebp+var_4], dl
>                mov     edx, eax
>                shr     edx, 10h
>                mov     byte ptr [ebp+var_4+1], dl
>                movsx   edx, ah
>                mov     byte ptr [ebp+var_4+3], al
>                mov     eax, [ebp+var_4]           ; returning var_4
>                mov     byte ptr [ebp+var_4+2], dl ; set last byte to var_4
>                leave
>                retn
> _Z5bswapj       endp
>
>
> --
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44260
>
>


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44260

Reply via email to