Patchwork RFA: MN10300: Fix for mn10300_regno_in_class_p

login
register
mail settings
Submitter Nick Clifton
Date Jan. 26, 2011, 11:26 a.m.
Message ID <m3tygvzz17.fsf@redhat.com>
Download mbox | patch
Permalink /patch/80498/
State New
Headers show

Comments

Nick Clifton - Jan. 26, 2011, 11:26 a.m.
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.
Jeff Law - Jan. 26, 2011, 3:02 p.m.
-----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-----

Patch

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