Patchwork invalid assert in convert_debug_memory_address

login
register
mail settings
Submitter DJ Delorie
Date Jan. 11, 2012, 9:13 p.m.
Message ID <201201112113.q0BLDwNp026422@greed.delorie.com>
Download mbox | patch
Permalink /patch/135502/
State New
Headers show

Comments

DJ Delorie - Jan. 11, 2012, 9:13 p.m.
The assert is not valid for address spaces that support more than one
pointer size, such as the generic space of TPF, mips64, or m32c.

2012-01-11  DJ Delorie  <dj@redhat.com>

	* cfgexpand.c (convert_debug_memory_address): Allow any valid
	pointer type, not just the default pointer type.
Richard Guenther - Jan. 12, 2012, 8:04 a.m.
On Wed, Jan 11, 2012 at 10:13 PM, DJ Delorie <dj@redhat.com> wrote:
>
> The assert is not valid for address spaces that support more than one
> pointer size, such as the generic space of TPF, mips64, or m32c.

Looks good to me.

Richard.

> 2012-01-11  DJ Delorie  <dj@redhat.com>
>
>        * cfgexpand.c (convert_debug_memory_address): Allow any valid
>        pointer type, not just the default pointer type.
>
> Index: cfgexpand.c
> ===================================================================
> --- cfgexpand.c      (revision 183092)
> +++ cfgexpand.c (working copy)
> @@ -2490,16 +2490,14 @@ convert_debug_memory_address (enum machi
>  #ifndef POINTERS_EXTEND_UNSIGNED
>   gcc_assert (mode == Pmode
>              || mode == targetm.addr_space.address_mode (as));
>   gcc_assert (xmode == mode || xmode == VOIDmode);
>  #else
>   rtx temp;
> -  enum machine_mode address_mode = targetm.addr_space.address_mode (as);
> -  enum machine_mode pointer_mode = targetm.addr_space.pointer_mode (as);
>
> -  gcc_assert (mode == address_mode || mode == pointer_mode);
> +  gcc_assert (targetm.addr_space.valid_pointer_mode (mode, as));
>
>   if (GET_MODE (x) == mode || GET_MODE (x) == VOIDmode)
>     return x;
>
>   if (GET_MODE_PRECISION (mode) < GET_MODE_PRECISION (xmode))
>     x = simplify_gen_subreg (mode, x, xmode,
DJ Delorie - Jan. 12, 2012, 9:37 p.m.
Thanks, committed.

Patch

Index: cfgexpand.c
===================================================================
--- cfgexpand.c      (revision 183092)
+++ cfgexpand.c (working copy)
@@ -2490,16 +2490,14 @@  convert_debug_memory_address (enum machi
 #ifndef POINTERS_EXTEND_UNSIGNED
   gcc_assert (mode == Pmode
              || mode == targetm.addr_space.address_mode (as));
   gcc_assert (xmode == mode || xmode == VOIDmode);
 #else
   rtx temp;
-  enum machine_mode address_mode = targetm.addr_space.address_mode (as);
-  enum machine_mode pointer_mode = targetm.addr_space.pointer_mode (as);
 
-  gcc_assert (mode == address_mode || mode == pointer_mode);
+  gcc_assert (targetm.addr_space.valid_pointer_mode (mode, as));
 
   if (GET_MODE (x) == mode || GET_MODE (x) == VOIDmode)
     return x;
 
   if (GET_MODE_PRECISION (mode) < GET_MODE_PRECISION (xmode))
     x = simplify_gen_subreg (mode, x, xmode,