public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* RFA: MN10300: Fix for mn10300_regno_in_class_p
@ 2011-01-26 11:43 Nick Clifton
  2011-01-26 15:40 ` Jeff Law
  0 siblings, 1 reply; 7+ messages in thread
From: Nick Clifton @ 2011-01-26 11:43 UTC (permalink / raw)
  To: aoliva, law; +Cc: gcc-patches

Hi Alex, Hi Jeff,

  Building the mn10300 toolchain currently fails with the am33 libgcc
  library because of an ICE in the mn10300 back end:

  .../libgcc/../gcc/unwind-dw2-fde.c: In function 'search_object':
  .../libgcc/../gcc/unwind-dw2-fde.c:992:1: internal compiler error: Segmentation fault

  The problem is the mn10300_regno_in_class_p() function which is
  assuming that if the provided regno is a pseudo register then
  the reg_renumber[] array will always return a hard register.  This is
  not true and the seg fault happens when this assumption is in
  correct.  Applying the simple patch below fixes the problem.

  Tested by building a mn10300-elf toolchain.

  OK to apply ?

Cheers
  Nick

gcc/ChangeLog
2011-01-26  Nick Clifton  <nickc@redhat.com>

	* config/mn10300/mn10300.c (mn10300_regno_in_class_p): Return
	false in strict mode when a renumbered register is a pseudo.

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 >= FIRST_PSEUDO_REGISTER)
+	return false;
     }
   return TEST_HARD_REG_BIT (reg_class_contents[rclass], regno);
 }

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: RFA: MN10300: Fix for mn10300_regno_in_class_p
  2011-01-26 11:43 RFA: MN10300: Fix for mn10300_regno_in_class_p Nick Clifton
@ 2011-01-26 15:40 ` Jeff Law
  2011-01-26 17:52   ` Nick Clifton
  0 siblings, 1 reply; 7+ messages in thread
From: Jeff Law @ 2011-01-26 15:40 UTC (permalink / raw)
  To: Nick Clifton; +Cc: aoliva, gcc-patches

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 01/26/11 04:26, Nick Clifton wrote:
> Hi Alex, Hi Jeff,
> 
>   Building the mn10300 toolchain currently fails with the am33 libgcc
>   library because of an ICE in the mn10300 back end:
> 
>   .../libgcc/../gcc/unwind-dw2-fde.c: In function 'search_object':
>   .../libgcc/../gcc/unwind-dw2-fde.c:992:1: internal compiler error: Segmentation fault
> 
>   The problem is the mn10300_regno_in_class_p() function which is
>   assuming that if the provided regno is a pseudo register then
>   the reg_renumber[] array will always return a hard register.  This is
>   not true and the seg fault happens when this assumption is in
>   correct.  Applying the simple patch below fixes the problem.
> 
>   Tested by building a mn10300-elf toolchain.
> 
>   OK to apply ?
> 
> Cheers
>   Nick
> 
> gcc/ChangeLog
> 2011-01-26  Nick Clifton  <nickc@redhat.com>
> 
> 	* config/mn10300/mn10300.c (mn10300_regno_in_class_p): Return
> 	false in strict mode when a renumbered register is a pseudo.
Under what circumstances can reg_renumber have anything other than a
hard register or -1?!?

Something seems amiss here.

jeff
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJNQDeGAAoJEBRtltQi2kC77+4H/R6uHh9sWJx/DMUB+a3v9aFj
luF28OnjNhWUmgD7LMYz2hwiIHDFSzsccenR2JIIQt2YNZd/3qE+3eAw7nI5H/TF
NkAQwHHX2SS3C9EDPIhsJlS4/4xBAM68vJ/wSw/95AvnYZrG1I0uJ1x6BIbJhxyN
GX484a28ZgJ0FntoLyzx3xkRwGI30PK+iJPEbfoxjdQO5kRPdBLdO5o7OpxLM32n
56AEYekV3X9QLTkZnMc4zHSUHT+96Biw5KF4iwbxAryGtHmAdpu7ZOh1nAYx6SuW
1zRWJBE6Jp7BWWndWgLXjxepv4bM1bAWA8rpddkZFHRfHeBjoA1M47dqiXSbX2c=
=6JyV
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: RFA: MN10300: Fix for mn10300_regno_in_class_p
  2011-01-26 15:40 ` Jeff Law
@ 2011-01-26 17:52   ` Nick Clifton
  2011-01-26 19:27     ` Richard Henderson
  2011-01-26 22:44     ` Jeff Law
  0 siblings, 2 replies; 7+ messages in thread
From: Nick Clifton @ 2011-01-26 17:52 UTC (permalink / raw)
  To: Jeff Law; +Cc: aoliva, gcc-patches

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);
  }

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: RFA: MN10300: Fix for mn10300_regno_in_class_p
  2011-01-26 17:52   ` Nick Clifton
@ 2011-01-26 19:27     ` Richard Henderson
  2011-01-26 22:44     ` Jeff Law
  1 sibling, 0 replies; 7+ messages in thread
From: Richard Henderson @ 2011-01-26 19:27 UTC (permalink / raw)
  To: Nick Clifton; +Cc: Jeff Law, aoliva, gcc-patches

On 01/26/2011 07:54 AM, Nick Clifton wrote:
> +      if (regno == (unsigned) -1)

This is named INVALID_REGNUM.


r~

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: RFA: MN10300: Fix for mn10300_regno_in_class_p
  2011-01-26 17:52   ` Nick Clifton
  2011-01-26 19:27     ` Richard Henderson
@ 2011-01-26 22:44     ` Jeff Law
  2011-01-27 10:40       ` Nick Clifton
  1 sibling, 1 reply; 7+ messages in thread
From: Jeff Law @ 2011-01-26 22:44 UTC (permalink / raw)
  To: Nick Clifton; +Cc: aoliva, gcc-patches

-----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-----

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: RFA: MN10300: Fix for mn10300_regno_in_class_p
  2011-01-26 22:44     ` Jeff Law
@ 2011-01-27 10:40       ` Nick Clifton
  2011-01-27 19:03         ` Jeff Law
  0 siblings, 1 reply; 7+ messages in thread
From: Nick Clifton @ 2011-01-27 10:40 UTC (permalink / raw)
  To: Jeff Law; +Cc: aoliva, gcc-patches

Hi Jeff,

   OK, here is the revised patch.  Can this version be applied please ?

Cheers
   Nick

gcc/ChangeLog
2011-01-27  Nick Clifton  <nickc@redhat.com>

	* config/mn10300/mn10300.c (mn10300_regno_in_class_p): Check for
	reg_renumber returning an INVALID_REGNUM.

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 == INVALID_REGNUM)
+	return false;
      }
    return TEST_HARD_REG_BIT (reg_class_contents[rclass], regno);
  }

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: RFA: MN10300: Fix for mn10300_regno_in_class_p
  2011-01-27 10:40       ` Nick Clifton
@ 2011-01-27 19:03         ` Jeff Law
  0 siblings, 0 replies; 7+ messages in thread
From: Jeff Law @ 2011-01-27 19:03 UTC (permalink / raw)
  To: Nick Clifton; +Cc: aoliva, gcc-patches

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 01/27/11 02:27, Nick Clifton wrote:
> Hi Jeff,
> 
>   OK, here is the revised patch.  Can this version be applied please ?
> 
> Cheers
>   Nick
> 
> gcc/ChangeLog
> 2011-01-27  Nick Clifton  <nickc@redhat.com>
> 
>     * config/mn10300/mn10300.c (mn10300_regno_in_class_p): Check for
>     reg_renumber returning an INVALID_REGNUM.
OK.
jeff
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJNQbaAAAoJEBRtltQi2kC77Y0H/iTRwok0OmRP5HWkc0q4t0nv
kHBVhgZKWbkduKY52xgVE8dEqjmN/AHymwVcM/HRCV8FedOHsdXYWgAgi3ec6qwC
4twa6X0iO+Yl4tE+Slfr9yhMoBEeFbCO4yoheVYM4gA8lgqgRwnj8VNL94C5BwiF
DP5BQcC97PO/45jiUdf6rG7sb33R9ad7kfqKkDKa1hNQuotP7AtSiI6E1VvQYieY
3Uti2VGpBxWKoZ74PFPpuadk7oIGOx4lwTveh7MHYvc6kvSaSz8+vVn3SN3u4r2/
LlKvn8PHR5HyfK6Wrv09dBwWggPvSsweNtYqjuJY9vXCnlstXw87ofhFDNCbnjo=
=MLeC
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-01-27 18:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-26 11:43 RFA: MN10300: Fix for mn10300_regno_in_class_p Nick Clifton
2011-01-26 15:40 ` Jeff Law
2011-01-26 17:52   ` Nick Clifton
2011-01-26 19:27     ` Richard Henderson
2011-01-26 22:44     ` Jeff Law
2011-01-27 10:40       ` Nick Clifton
2011-01-27 19:03         ` Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).