Hi! This patch fixes some minor nits I've raised in the PR, more severe issues left unresolved there.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2016-11-30 Jakub Jelinek <ja...@redhat.com> PR tree-optimization/78586 * gimple-ssa-sprintf.c (format_integer): Don't handle NOP_EXPR, CONVERT_EXPR or COMPONENT_REF here. Formatting fix. For SSA_NAME_DEF_STMT with NOP_EXPR only change argtype if the rhs1's type is INTEGER_TYPE or POINTER_TYPE. --- gcc/gimple-ssa-sprintf.c.jj 2016-11-30 09:00:42.000000000 +0100 +++ gcc/gimple-ssa-sprintf.c 2016-11-30 12:57:05.996480633 +0100 @@ -968,24 +968,13 @@ format_integer (const conversion_spec &s } else if (TREE_CODE (TREE_TYPE (arg)) == INTEGER_TYPE || TREE_CODE (TREE_TYPE (arg)) == POINTER_TYPE) - { - /* Determine the type of the provided non-constant argument. */ - if (TREE_CODE (arg) == NOP_EXPR) - arg = TREE_OPERAND (arg, 0); - else if (TREE_CODE (arg) == CONVERT_EXPR) - arg = TREE_OPERAND (arg, 0); - if (TREE_CODE (arg) == COMPONENT_REF) - arg = TREE_OPERAND (arg, 1); - - argtype = TREE_TYPE (arg); - } + /* Determine the type of the provided non-constant argument. */ + argtype = TREE_TYPE (arg); else - { - /* Don't bother with invalid arguments since they likely would - have already been diagnosed, and disable any further checking - of the format string by returning [-1, -1]. */ - return fmtresult (); - } + /* Don't bother with invalid arguments since they likely would + have already been diagnosed, and disable any further checking + of the format string by returning [-1, -1]. */ + return fmtresult (); fmtresult res; @@ -1059,7 +1048,12 @@ format_integer (const conversion_spec &s } if (code == NOP_EXPR) - argtype = TREE_TYPE (gimple_assign_rhs1 (def)); + { + tree type = TREE_TYPE (gimple_assign_rhs1 (def)); + if (TREE_CODE (type) == INTEGER_TYPE + || TREE_CODE (type) == POINTER_TYPE) + argtype = type; + } } } } Jakub