summaryrefslogtreecommitdiff
path: root/gcc/c-format.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2002-02-20 22:54:35 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2002-02-20 22:54:35 +0000
commitc53485bbb81a5ddaeeceb228bb0ed1328b5c2e0e (patch)
tree92091a1ae9884506ec5a5bd1f121978289726ebf /gcc/c-format.c
parent00c7100f102b06d2844bffb7bbf69c78f1bd5d55 (diff)
downloadgcc-c53485bbb81a5ddaeeceb228bb0ed1328b5c2e0e.tar.gz
PR c/4389
* tree.c (host_integerp): Ensure that the constant integer is representable in a HOST_WIDE_INT or an unsigned HOST_WIDE_INT when pos is zero or non-zero respectively. Clarify comment. * c-format.c (check_format_info_recurse): Fix host_integerp usage; the pos argument should be zero when assigning to a signed HOST_WIDE_INT. * gcc.dg/20020219-1.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@49914 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-format.c')
-rw-r--r--gcc/c-format.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/gcc/c-format.c b/gcc/c-format.c
index b15b6300563..d52cfba7c70 100644
--- a/gcc/c-format.c
+++ b/gcc/c-format.c
@@ -1,6 +1,6 @@
/* Check calls to formatted I/O functions (-Wformat).
- Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
- Free Software Foundation, Inc.
+ Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+ 2001, 2002 Free Software Foundation, Inc.
This file is part of GCC.
@@ -1516,13 +1516,12 @@ check_format_info_recurse (status, res, info, format_tree, params, arg_num)
res->number_non_literal++;
return;
}
- if (!host_integerp (arg1, 1))
+ if (!host_integerp (arg1, 0)
+ || (offset = tree_low_cst (arg1, 0)) < 0)
{
res->number_non_literal++;
return;
}
-
- offset = TREE_INT_CST_LOW (arg1);
}
if (TREE_CODE (format_tree) != ADDR_EXPR)
{