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 incorrect byte swap detection (PR tree-optimization/60454)


4.8 also has this bug. OK to backport?

On Tue, Mar 11, 2014 at 6:59 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Tue, Mar 11, 2014 at 06:48:37PM +0800, Thomas Preud'homme wrote:
>> I also added a typedef unsigned uint32_t for when sizeof(unsigned) == 4. I hope it's right.
>
> In theory you could have __CHAR_BIT__ different from 8 and what you care
> about is that uint32_t has exactly 32 bits, so the check would need to be
>   if (sizeof (uint32_t) * __CHAR_BIT__ != 32)
>     return 0;
>
>> +  if (fake_swap32 (0x12345678) != 0x78567E12)
>> +    __builtin_abort ();
>
> Also, for int16 targets where __UINT32_TYPE__ is supposedly unsigned long,
> I think you would need to use:
>
>   if (fake_swap32 (0x12345678UL) != 0x78567E12UL)
>     __builtin_abort ();
>
> (the C standard guarantees that unsigned long is at least 32-bit and
> unsigned int at least 16-bit).
>
> Ok with those changes.
>
> Do you have write access, or will somebody from your coworkers commit it for
> you?  Are you covered by ARM GCC Copyright assignment?
>
>         Jakub


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