https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89998
--- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Author: jakub Date: Tue Apr 30 20:58:00 2019 New Revision: 270745 URL: https://gcc.gnu.org/viewcvs?rev=270745&root=gcc&view=rev Log: Backported from mainline 2019-04-09 Jakub Jelinek <ja...@redhat.com> PR tree-optimization/89998 * gimple-ssa-sprintf.c (try_substitute_return_value): Use lhs type instead of integer_type_node if possible, don't add ranges if return type is not compatible with int. * gimple-fold.c (gimple_fold_builtin_sprintf, gimple_fold_builtin_snprintf): Use lhs type instead of hardcoded integer_type_node. * gcc.c-torture/compile/pr89998-1.c: New test. * gcc.c-torture/compile/pr89998-2.c: New test. Added: branches/gcc-8-branch/gcc/testsuite/gcc.c-torture/compile/pr89998-1.c branches/gcc-8-branch/gcc/testsuite/gcc.c-torture/compile/pr89998-2.c Modified: branches/gcc-8-branch/gcc/ChangeLog branches/gcc-8-branch/gcc/gimple-fold.c branches/gcc-8-branch/gcc/gimple-ssa-sprintf.c branches/gcc-8-branch/gcc/testsuite/ChangeLog