GCSE: Use HOST_WIDE_INT instead of int (PR, rtl-optimization/79574).

Bernd Schmidt bschmidt@redhat.com
Thu Mar 2 19:58:00 GMT 2017


On 03/02/2017 06:50 PM, Martin Liška wrote:
> Hello.
>
> This is second part of fixes needed to not trigger integer overflow in gcse pass.

So, how is this intended to work? The min/max stored in the param is an 
int, and by using a HOST_WIDE_INT here, we expect that it is a larger 
type and therefore won't overflow?

>        {
>  	expr = flat_table[i];
>  	fprintf (file, "Index %d (hash value %d; max distance %d)\n  ",
> -		 expr->bitmap_index, hash_val[i], expr->max_distance);
> +		 expr->bitmap_index, hash_val[i], (int)expr->max_distance);
>  	print_rtl (file, expr->expr);
>  	fprintf (file, "\n");

Use HOST_WIDE_INT_PRINT_DEC maybe? Otherwise OK, I guess.


Bernd



More information about the Gcc-patches mailing list