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: GCSE: Use HOST_WIDE_INT instead of int (PR, rtl-optimization/79574).


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


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