This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: m32c support for named addr spaces branch


DJ Delorie wrote:

> Found it, bug in expr.c:
> 
> Index: expr.c
> ===================================================================
> --- expr.c	(revision 152895)
> +++ expr.c	(working copy)
> @@ -4248,13 +4248,13 @@ expand_assignment (tree to, tree from, b
>  	    }
>  
>  	  offset_rtx = expand_expr (offset, NULL_RTX, VOIDmode, EXPAND_SUM);
>  	  address_mode
>  	    = targetm.addr_space.address_mode (MEM_ADDR_SPACE (to_rtx));
>  	  if (GET_MODE (offset_rtx) != address_mode)
> -	    offset_rtx = convert_to_mode (address_mode, offset_rtx, 0);
> +	    offset_rtx = convert_to_mode (address_mode, offset_rtx, POINTERS_EXTEND_UNSIGNED);

I'm not sure POINTERS_EXTEND_UNSIGNED is the correct test here; the offset
is not itself a pointer type.  What if the offset actually *is* a negative
value of a smaller, signed type?

Maybe this should take the signed-ness of the type of "offset" into
account instead.

(B.t.w. there are more instances of computing address offsets that should
probably be handled analogously.  Look for other instances of offset_address
in expr.c ...)

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]