===================================================================
@@ -66,7 +66,7 @@ int test (int x)
template <typename Int, Int D>
void f(Int x) {
- assert(0 <= x and x <= D); // { dg-warning "comparison is always true due to limited range of data type" }
+ assert(0 <= x and x <= D);
}
int ff(void) {
===================================================================
@@ -66,7 +66,7 @@ int test (int x)
template <typename Int, Int D>
void f(Int x) {
- assert(0 <= x and x <= D); // { dg-warning "comparison is always true due to limited range of data type" }
+ assert(0 <= x and x <= D);
}
int ff(void) {
===================================================================
@@ -13608,7 +13610,11 @@ tsubst_copy_and_build (tree t,
case MEMBER_REF:
case DOTSTAR_EXPR:
{
- tree r = build_x_binary_op
+ tree r;
+
+ ++c_inhibit_evaluation_warnings;
+
+ r = build_x_binary_op
(input_location, TREE_CODE (t),
RECUR (TREE_OPERAND (t, 0)),
(TREE_NO_WARNING (TREE_OPERAND (t, 0))
@@ -13622,6 +13628,9 @@ tsubst_copy_and_build (tree t,
complain);
if (EXPR_P (r) && TREE_NO_WARNING (t))
TREE_NO_WARNING (r) = TREE_NO_WARNING (t);
+
+ --c_inhibit_evaluation_warnings;
+
return r;
}
===================================================================
@@ -3754,7 +3754,8 @@ shorten_compare (tree *op0_ptr, tree *op1_ptr, tre
type = c_common_unsigned_type (type);
}
- if (TREE_CODE (primop0) != INTEGER_CST)
+ if (TREE_CODE (primop0) != INTEGER_CST
+ && c_inhibit_evaluation_warnings == 0)
{
if (val == truthvalue_false_node)
warning_at (loc, OPT_Wtype_limits,
@@ -3834,6 +3835,7 @@ shorten_compare (tree *op0_ptr, tree *op1_ptr, tre
warning. */
bool warn =
warn_type_limits && !in_system_header
+ && c_inhibit_evaluation_warnings == 0
&& !(TREE_CODE (primop0) == INTEGER_CST
&& !TREE_OVERFLOW (convert (c_common_signed_type (type),
primop0)))