Re: [PATCH] avoid using types wider than int for width and precision (PR 80364)

2017-04-11 Thread Martin Sebor
if (TREE_CODE (arg) == SSA_NAME - && TREE_CODE (type) == INTEGER_TYPE) + && TREE_CODE (argtype) == INTEGER_TYPE I think you want && INTEGRAL_TYPE_P (argtype) here instead of that last line, the middle-end considers conversions between integral types useless (exce

Re: [PATCH] avoid using types wider than int for width and precision (PR 80364)

2017-04-11 Thread Jakub Jelinek
On Mon, Apr 10, 2017 at 04:16:42PM -0600, Martin Sebor wrote: > gcc/ChangeLog: > > PR middle-end/80364 > * gimple-ssa-sprintf.c (get_int_range): Remove second argument and > always use the int type. > (directive::set_width, directive::set_precision, format_character): >

Re: [PATCH] avoid using types wider than int for width and precision (PR 80364)

2017-04-10 Thread Martin Sebor
@@ -972,11 +972,11 @@ get_int_range (tree arg, tree type, HOST_WIDE_INT *pmin, HOST_WIDE_INT *pmax, if (range_type == VR_RANGE) { HOST_WIDE_INT type_min - = (TYPE_UNSIGNED (type) - ? tree_to_uhwi (TYPE_MIN_VALUE (type)) -

Re: [PATCH] avoid using types wider than int for width and precision (PR 80364)

2017-04-09 Thread Jakub Jelinek
On Sun, Apr 09, 2017 at 05:06:58PM -0600, Martin Sebor wrote: > PR middle-end/80364 - sanitizer detects signed integer overflow in > gimple-ssa-sprintf.c > > gcc/ChangeLog: > > PR middle-end/80364 > * gimple-ssa-sprintf.c (get_int_range): Use the specified type when > recursing