https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78586
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- --- gcc/gimple-ssa-sprintf.c.jj 2016-11-28 23:50:20.000000000 +0100 +++ gcc/gimple-ssa-sprintf.c 2016-11-29 15:03:29.201488577 +0100 @@ -1159,16 +1159,15 @@ format_integer (const conversion_spec &s if (TYPE_UNSIGNED (argtype)) argmax = build_all_ones_cst (argtype); else - argmax = fold_build2 (LSHIFT_EXPR, argtype, integer_one_node, + argmax = fold_build2 (LSHIFT_EXPR, argtype, + build_int_cst (argtype, 1), build_int_cst (integer_type_node, argprec - 1)); } else - { - argmax = fold_build2 (LSHIFT_EXPR, dirtype, integer_one_node, - build_int_cst (integer_type_node, - typeprec - 1)); - } + argmax = fold_build2 (LSHIFT_EXPR, dirtype, + build_int_cst (dirtype, 1), + build_int_cst (integer_type_node, typeprec - 1)); res.argmin = argmin; res.argmax = argmax; } fixes it, that is a rather obvious bug. But, I want to think about whether we can't/shouldn't just use TYPE_{MIN,MAX}_VALUE (TYPE_DOMAIN (...)) instead.