aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-decl.c
diff options
context:
space:
mode:
authorManuel López-Ibáñez <manu@gcc.gnu.org>2008-10-29 17:16:46 +0000
committerManuel López-Ibáñez <manu@gcc.gnu.org>2008-10-29 17:16:46 +0000
commitcdd6a337c0e1c4a07a0a45686dcaa159e51f451c (patch)
tree42ccc636ef21cba0db86051f05076ac6b24aa628 /gcc/c-decl.c
parent20ded7a68b10f9c2d1aaa94e89df494bf0ce41a0 (diff)
downloadgcc-cdd6a337c0e1c4a07a0a45686dcaa159e51f451c.zip
gcc-cdd6a337c0e1c4a07a0a45686dcaa159e51f451c.tar.gz
gcc-cdd6a337c0e1c4a07a0a45686dcaa159e51f451c.tar.bz2
re PR middle-end/11492 (Bogus warning with -Wsign-compare)
2008-10-29 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR 11492 * c-common.c (min_precision): Move to... * tree.c (tree_int_cst_min_precision): ... to here. Renamed. * tree.h (tree_int_cst_min_precision): Declare. * c-common.h (min_precision): Delete declaration. * fold-const.c (tree_binary_nonnegative_warnv_p): Handle multiplication of non-negative integer constants. * c-decl.c (check_bitfield_type_and_width): Rename min_precision to tree_int_cst_min_precision. (finish_enum): Likewise. cp/ * class.c (check_bitfield_decl): Rename min_precision to tree_int_cst_min_precision. * decl.c (finish_enum): Likewise. testsuite/ * gcc.dg/pr11492.c: New. * g++.dg/warn/pr11492.C: New. From-SVN: r141434
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r--gcc/c-decl.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index eba6161..6f88f62 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -3869,8 +3869,8 @@ check_bitfield_type_and_width (tree *type, tree *width, const char *orig_name)
{
struct lang_type *lt = TYPE_LANG_SPECIFIC (*type);
if (!lt
- || w < min_precision (lt->enum_min, TYPE_UNSIGNED (*type))
- || w < min_precision (lt->enum_max, TYPE_UNSIGNED (*type)))
+ || w < tree_int_cst_min_precision (lt->enum_min, TYPE_UNSIGNED (*type))
+ || w < tree_int_cst_min_precision (lt->enum_max, TYPE_UNSIGNED (*type)))
warning (0, "%qs is narrower than values of its type", name);
}
}
@@ -5866,8 +5866,8 @@ finish_enum (tree enumtype, tree values, tree attributes)
that normally we only go as narrow as int - and signed iff any of
the values are negative. */
unsign = (tree_int_cst_sgn (minnode) >= 0);
- precision = MAX (min_precision (minnode, unsign),
- min_precision (maxnode, unsign));
+ precision = MAX (tree_int_cst_min_precision (minnode, unsign),
+ tree_int_cst_min_precision (maxnode, unsign));
if (TYPE_PACKED (enumtype) || precision > TYPE_PRECISION (integer_type_node))
{