aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-ssa-sprintf.c
diff options
context:
space:
mode:
authorMartin Sebor <msebor@redhat.com>2017-07-10 21:21:51 +0000
committerMartin Sebor <msebor@gcc.gnu.org>2017-07-10 15:21:51 -0600
commit9c582dbb57486afa5675217dd0cccf3ba5bea4eb (patch)
treed47b7b5eae64ee6e43db31eb4bbc5d91b92de41b /gcc/gimple-ssa-sprintf.c
parentb2221d2bc678887616b5517c2e935480528556f0 (diff)
downloadgcc-9c582dbb57486afa5675217dd0cccf3ba5bea4eb.zip
gcc-9c582dbb57486afa5675217dd0cccf3ba5bea4eb.tar.gz
gcc-9c582dbb57486afa5675217dd0cccf3ba5bea4eb.tar.bz2
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
Diffstat (limited to 'gcc/gimple-ssa-sprintf.c')
-rw-r--r--gcc/gimple-ssa-sprintf.c6
1 files changed, 3 insertions, 3 deletions
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;
}