From 9c582dbb57486afa5675217dd0cccf3ba5bea4eb Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Mon, 10 Jul 2017 21:21:51 +0000 Subject: PR tree-optimization/80397 - missing -Wformat-overflow with arguments of enum types gcc/ChangeLog: PR tree-optimization/80397 * gimple-ssa-sprintf.c (format_integer): Use INTEGRAL_TYPE_P() instead of testing for equality to INTEGER_TYPE. gcc/testsuite/ChangeLog: PR tree-optimization/80397 * gcc.dg/tree-ssa/builtin-sprintf-warn-17.c: New test. From-SVN: r250106 --- gcc/gimple-ssa-sprintf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gcc/gimple-ssa-sprintf.c') diff --git a/gcc/gimple-ssa-sprintf.c b/gcc/gimple-ssa-sprintf.c index f43778b..644cf7e 100644 --- a/gcc/gimple-ssa-sprintf.c +++ b/gcc/gimple-ssa-sprintf.c @@ -1407,7 +1407,7 @@ format_integer (const directive &dir, tree arg) return res; } - else if (TREE_CODE (TREE_TYPE (arg)) == INTEGER_TYPE + else if (INTEGRAL_TYPE_P (TREE_TYPE (arg)) || TREE_CODE (TREE_TYPE (arg)) == POINTER_TYPE) /* Determine the type of the provided non-constant argument. */ argtype = TREE_TYPE (arg); @@ -1427,7 +1427,7 @@ format_integer (const directive &dir, tree arg) if (arg && TREE_CODE (arg) == SSA_NAME - && TREE_CODE (argtype) == INTEGER_TYPE) + && INTEGRAL_TYPE_P (argtype)) { /* Try to determine the range of values of the integer argument (range information is not available for pointers). */ @@ -1472,7 +1472,7 @@ format_integer (const directive &dir, tree arg) if (code == NOP_EXPR) { tree type = TREE_TYPE (gimple_assign_rhs1 (def)); - if (TREE_CODE (type) == INTEGER_TYPE + if (INTEGRAL_TYPE_P (type) || TREE_CODE (type) == POINTER_TYPE) argtype = type; } -- cgit v1.1