This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix incorrect byte swap detection (PR tree-optimization/60454)
- From: Joey Ye <joey dot ye dot cc at gmail dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: "Thomas Preud'homme" <thomas dot preudhomme at arm dot com>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 12 Mar 2014 11:43:00 +0800
- Subject: Re: [PATCH] Fix incorrect byte swap detection (PR tree-optimization/60454)
- Authentication-results: sourceware.org; auth=none
- References: <000301cf39e8$84eb6910$8ec23b30$ at arm dot com> <20140307141555 dot GJ22862 at tucnak dot redhat dot com> <000001cf3cf6$a3ef8b00$ebcea100$ at arm dot com> <20140311095417 dot GY22862 at tucnak dot redhat dot com> <000401cf3d17$76a460a0$63ed21e0$ at arm dot com> <20140311105900 dot GA22862 at tucnak dot redhat dot com>
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