RFA: MN10300: Fix for mn10300_regno_in_class_p
Jeff Law
law@redhat.com
Wed Jan 26 22:44:00 GMT 2011
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 01/26/11 08:54, Nick Clifton wrote:
> Hi Jeff,
>
>> Under what circumstances can reg_renumber have anything other than a
>> hard register or -1?!?
>>
>> Something seems amiss here.
>
> I was not sure, but it seemed to be safest to check for any result that
> would be outside of the range supported by TEST_HARD_REG_BIT(). As it
> happens in the case of compiling unwind-dw2-fde.c the result is -1, but
> this is assigned to 'regno' which is an unsigned int, so it becomes
> MAX_UINT.
>
> Would you prefer this version of the patch instead ? It also works, but
> it seems less paranoid to me. :-)
>
> Cheers
> Nick
>
> Index: gcc/config/mn10300/mn10300.c
> ===================================================================
> --- gcc/config/mn10300/mn10300.c (revision 169278)
> +++ gcc/config/mn10300/mn10300.c (working copy)
> @@ -1996,6 +1996,8 @@
> if (!reg_renumber)
> return false;
> regno = reg_renumber[regno];
> + if (regno == (unsigned) -1)
> + return false;
> }
> return TEST_HARD_REG_BIT (reg_class_contents[rclass], regno);
As rth entioned, you need to test for INVALID_REGNUM rather than using a
special constant.
Jeff
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/
iQEcBAEBAgAGBQJNQJx7AAoJEBRtltQi2kC7SfsIAKmKkGNrkbwXyFc7tLicJyph
Xez0gd0rR9ccmEduBEjtKo1P0vjDC9ql4IWqGAq8N9iUMESi+1IaD9gQGL7oFXnf
rZqfmnmqda0YajdNwbKitc81ecI/bgSZVEeiGdllM3Akwkj+AsxwvdmzTe2nWVjk
QSss0i4z3/92ZFTnylctAT9XnnqLFWcEvP7t5VUhr3lVOuWg/STvHKsVQkOgMVd9
kR/WnpBk09jZRPn/ibOY4w8zXkBlAfFTE+8DqQE7VS9md7VXAqtlUuEaWZTVZ8Q7
9NVSTD4Q8XBwHv/RiHlaTFaSVH4C7FFKUxPG0bXxF9aCMvM//+aw572072ZwR9c=
=OOcy
-----END PGP SIGNATURE-----
More information about the Gcc-patches
mailing list