[PATCH] Fix gnatchop on powerpc*-linux

Olivier Hainque hainque@adacore.com
Tue Sep 1 08:41:00 GMT 2009


Hi Jakub,

Jakub Jelinek wrote:
> FAIL:   a22006b
> The problem is that now that POINTER_SIZE is an unsigned int variable on
> powerpc, instead of something ? 64 : 32,

 Thanks for testing Ada and for your summary.

> The following patch fixes that by casting POINTER_SIZE to HOST_WIDE_INT in
> those 2 places in Ada FE and one in Java FE.

> 	* gcc-interface/utils2.c (maybe_wrap_malloc, maybe_wrap_free): Cast
> 	POINTER_SIZE to HOST_WIDE_INT.

 Ok with a minor change:

> -			   size_int (-POINTER_SIZE/BITS_PER_UNIT));
> +			   size_int (-(HOST_WIDE_INT) POINTER_SIZE
> +				     / BITS_PER_UNIT));
>  
>        tree storage_ptr_slot
>  	= build_unary_op (INDIRECT_REF, NULL_TREE,
> @@ -2013,7 +2014,7 @@ maybe_wrap_free (tree data_ptr, tree dat
>  	= build_binary_op
>  	  (POINTER_PLUS_EXPR, ptr_void_type_node,
>  	   convert (ptr_void_type_node, data_ptr),
> -	   size_int (-POINTER_SIZE/BITS_PER_UNIT));
> +	   size_int (-(HOST_WIDE_INT) POINTER_SIZE/BITS_PER_UNIT));

 For the latter expression, I think the intent would be more
 clearly conveyed as

   -(HOST_WIDE_INT)POINTER_SIZE / BITS_PER_UNIT

 I believe the coding standard allows this and I'd adjust the former
 expression accordingly.

 Thanks,

 Olivier



More information about the Gcc-patches mailing list