[patch] initiailzing non-default-sized pointers

Mark Mitchell mark@codesourcery.com
Thu Aug 17 00:03:00 GMT 2006


DJ Delorie wrote:

> [gcc]
> 	* fold-const.c (force_fit_type): Don't assume pointers are
> 	always the same size.
> 	* convert.c (convert_to_pointer): Convert to requested size,
> 	not the default size.
> 
> [gcc/cp]
> 	* cvt.c (cp_convert_to_pointer): Convert to requested size,
> 	not the default size.

This is OK for 4.3.  (This isn't a regression; therefore not appropriate
at this time.)

> Index: fold-const.c
> ===================================================================
> --- fold-const.c	(revision 116166)
> +++ fold-const.c	(working copy)
> @@ -217,8 +217,7 @@ force_fit_type (tree t, int overflowable
>    low = TREE_INT_CST_LOW (t);
>    high = TREE_INT_CST_HIGH (t);
>  
> -  if (POINTER_TYPE_P (TREE_TYPE (t))
> -      || TREE_CODE (TREE_TYPE (t)) == OFFSET_TYPE)
> +  if (TREE_CODE (TREE_TYPE (t)) == OFFSET_TYPE)
>      prec = POINTER_SIZE;
>    else
>      prec = TYPE_PRECISION (TREE_TYPE (t));

I'm not sure why we use POINTER_SIZE for OFFSET_TYPE.  Why not just
always use TYPE_PRECISION?  You don't have to answer this, as your patch
has no impact here; I'm just asking...

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713



More information about the Gcc-patches mailing list