+2017-08-09 Marek Polacek <polacek@redhat.com>
+
+ PR c/81417
+ * input.c (make_location): New overload.
+ * input.h (make_location): Declare.
+
2017-08-08 Alan Modra <amodra@gmail.com>
H.J. Lu <hongjiu.lu@intel.com>
+2017-08-09 Marek Polacek <polacek@redhat.com>
+
+ PR c/81417
+ * c-array-notation.c (fix_builtin_array_notation_fn): Update calls to
+ build_conditional_expr.
+ * c-parser.c (c_parser_conditional_expression): Create locations for
+ EXP1 and EXP2 from their source ranges. Pass the locations down to
+ build_conditional_expr.
+ * c-tree.h (build_conditional_expr): Update declaration.
+ * c-typeck.c (build_conditional_expr): Add location_t parameters.
+ For -Wsign-compare, also print the types.
+
2017-08-08 Martin Liska <mliska@suse.cz>
* c-convert.c: Include header files.
new_cond_expr = build2 (NE_EXPR, TREE_TYPE (func_parm), func_parm,
build_zero_cst (TREE_TYPE (func_parm)));
new_expr = build_conditional_expr
- (location, new_cond_expr, false, new_yes_expr,
- TREE_TYPE (new_yes_expr), new_no_expr, TREE_TYPE (new_no_expr));
+ (location, new_cond_expr, false,
+ new_yes_expr, TREE_TYPE (new_yes_expr), location,
+ new_no_expr, TREE_TYPE (new_no_expr), location);
break;
case BUILT_IN_CILKPLUS_SEC_REDUCE_ALL_NONZERO:
new_var_init = build_modify_expr
new_cond_expr = build2 (EQ_EXPR, TREE_TYPE (func_parm), func_parm,
build_zero_cst (TREE_TYPE (func_parm)));
new_expr = build_conditional_expr
- (location, new_cond_expr, false, new_yes_expr,
- TREE_TYPE (new_yes_expr), new_no_expr, TREE_TYPE (new_no_expr));
+ (location, new_cond_expr, false,
+ new_yes_expr, TREE_TYPE (new_yes_expr), location,
+ new_no_expr, TREE_TYPE (new_no_expr), location);
break;
case BUILT_IN_CILKPLUS_SEC_REDUCE_ANY_ZERO:
new_var_init = build_modify_expr
new_cond_expr = build2 (EQ_EXPR, TREE_TYPE (func_parm), func_parm,
build_zero_cst (TREE_TYPE (func_parm)));
new_expr = build_conditional_expr
- (location, new_cond_expr, false, new_yes_expr,
- TREE_TYPE (new_yes_expr), new_no_expr, TREE_TYPE (new_no_expr));
+ (location, new_cond_expr, false,
+ new_yes_expr, TREE_TYPE (new_yes_expr), location,
+ new_no_expr, TREE_TYPE (new_no_expr), location);
break;
case BUILT_IN_CILKPLUS_SEC_REDUCE_ANY_NONZERO:
new_var_init = build_modify_expr
new_cond_expr = build2 (NE_EXPR, TREE_TYPE (func_parm), func_parm,
build_zero_cst (TREE_TYPE (func_parm)));
new_expr = build_conditional_expr
- (location, new_cond_expr, false, new_yes_expr,
- TREE_TYPE (new_yes_expr), new_no_expr, TREE_TYPE (new_no_expr));
+ (location, new_cond_expr, false,
+ new_yes_expr, TREE_TYPE (new_yes_expr), location,
+ new_no_expr, TREE_TYPE (new_no_expr), location);
break;
case BUILT_IN_CILKPLUS_SEC_REDUCE_MAX:
if (TYPE_MIN_VALUE (new_var_type))
new_expr = build_conditional_expr
(location,
build2 (LT_EXPR, TREE_TYPE (*new_var), *new_var, func_parm), false,
- new_yes_expr, TREE_TYPE (*new_var), new_no_expr, TREE_TYPE (*new_var));
+ new_yes_expr, TREE_TYPE (*new_var), location,
+ new_no_expr, TREE_TYPE (*new_var), location);
break;
case BUILT_IN_CILKPLUS_SEC_REDUCE_MIN:
if (TYPE_MAX_VALUE (new_var_type))
new_expr = build_conditional_expr
(location,
build2 (GT_EXPR, TREE_TYPE (*new_var), *new_var, func_parm), false,
- new_yes_expr, TREE_TYPE (*new_var), new_no_expr, TREE_TYPE (*new_var));
+ new_yes_expr, TREE_TYPE (*new_var), location,
+ new_no_expr, TREE_TYPE (*new_var), location);
break;
case BUILT_IN_CILKPLUS_SEC_REDUCE_MAX_IND:
new_var_init = build_modify_expr
build2 (LE_EXPR, TREE_TYPE (array_ind_value), array_ind_value,
func_parm),
false,
- new_yes_list, TREE_TYPE (*new_var), new_no_list, TREE_TYPE (*new_var));
+ new_yes_list, TREE_TYPE (*new_var), location,
+ new_no_list, TREE_TYPE (*new_var), location);
break;
case BUILT_IN_CILKPLUS_SEC_REDUCE_MIN_IND:
new_var_init = build_modify_expr
build2 (GE_EXPR, TREE_TYPE (array_ind_value), array_ind_value,
func_parm),
false,
- new_yes_list, TREE_TYPE (*new_var), new_no_list, TREE_TYPE (*new_var));
+ new_yes_list, TREE_TYPE (*new_var), location,
+ new_no_list, TREE_TYPE (*new_var), location);
break;
case BUILT_IN_CILKPLUS_SEC_REDUCE:
new_var_init = build_modify_expr
tree omp_atomic_lhs)
{
struct c_expr cond, exp1, exp2, ret;
- location_t start, cond_loc, colon_loc, middle_loc;
+ location_t start, cond_loc, colon_loc;
gcc_assert (!after || c_dialect_objc ());
{
tree eptype = NULL_TREE;
- middle_loc = c_parser_peek_token (parser)->location;
+ location_t middle_loc = c_parser_peek_token (parser)->location;
pedwarn (middle_loc, OPT_Wpedantic,
"ISO C forbids omitting the middle term of a ?: expression");
if (TREE_CODE (cond.value) == EXCESS_PRECISION_EXPR)
if (eptype)
exp1.value = build1 (EXCESS_PRECISION_EXPR, eptype, exp1.value);
exp1.original_type = NULL;
+ exp1.src_range = cond.src_range;
cond.value = c_objc_common_truthvalue_conversion (cond_loc, exp1.value);
c_inhibit_evaluation_warnings += cond.value == truthvalue_true_node;
}
exp2 = convert_lvalue_to_rvalue (exp2_loc, exp2, true, true);
}
c_inhibit_evaluation_warnings -= cond.value == truthvalue_true_node;
+ location_t loc1 = make_location (exp1.get_start (), exp1.src_range);
+ location_t loc2 = make_location (exp2.get_start (), exp2.src_range);
ret.value = build_conditional_expr (colon_loc, cond.value,
cond.original_code == C_MAYBE_CONST_EXPR,
- exp1.value, exp1.original_type,
- exp2.value, exp2.original_type);
+ exp1.value, exp1.original_type, loc1,
+ exp2.value, exp2.original_type, loc2);
ret.original_code = ERROR_MARK;
if (exp1.value == error_mark_node || exp2.value == error_mark_node)
ret.original_type = NULL;
enum tree_code, struct c_expr,
struct c_expr);
extern tree build_conditional_expr (location_t, tree, bool, tree, tree,
- tree, tree);
+ location_t, tree, tree, location_t);
extern tree build_compound_expr (location_t, tree, tree);
extern tree c_cast_expr (location_t, struct c_type_name *, tree);
extern tree build_c_cast (location_t, tree, tree);
tree
build_conditional_expr (location_t colon_loc, tree ifexp, bool ifexp_bcp,
- tree op1, tree op1_original_type, tree op2,
- tree op2_original_type)
+ tree op1, tree op1_original_type, location_t op1_loc,
+ tree op2, tree op2_original_type, location_t op2_loc)
{
tree type1;
tree type2;
|| (unsigned_op1
&& tree_expr_nonnegative_warnv_p (op2, &ovf)))
/* OK */;
+ else if (unsigned_op2)
+ warning_at (op1_loc, OPT_Wsign_compare,
+ "operand of ?: changes signedness from "
+ "%qT to %qT due to unsignedness of other "
+ "operand", TREE_TYPE (orig_op1),
+ TREE_TYPE (orig_op2));
else
- warning_at (colon_loc, OPT_Wsign_compare,
- ("signed and unsigned type in "
- "conditional expression"));
+ warning_at (op2_loc, OPT_Wsign_compare,
+ "operand of ?: changes signedness from "
+ "%qT to %qT due to unsignedness of other "
+ "operand", TREE_TYPE (orig_op2),
+ TREE_TYPE (orig_op1));
}
if (!op1_maybe_const || TREE_CODE (op1) != INTEGER_CST)
op1 = c_wrap_maybe_const (op1, !op1_maybe_const);
return combined_loc;
}
+/* Same as above, but taking a source range rather than two locations. */
+
+location_t
+make_location (location_t caret, source_range src_range)
+{
+ location_t pure_loc = get_pure_location (caret);
+ return COMBINE_LOCATION_DATA (line_table, pure_loc, src_range, NULL);
+}
+
#define ONE_K 1024
#define ONE_M (ONE_K * ONE_K)
extern location_t make_location (location_t caret,
location_t start, location_t finish);
+extern location_t make_location (location_t caret, source_range src_range);
void dump_line_table_statistics (void);
+2017-08-09 Marek Polacek <polacek@redhat.com>
+
+ PR c/81417
+ * objc-next-runtime-abi-02.c (build_v2_build_objc_method_call): Update
+ a call to build_conditional_expr.
+
2017-08-08 Martin Liska <mliska@suse.cz>
* objc-gnu-runtime-abi-01.c: Include header files.
/* ??? CHECKME. */
ret_val = build_conditional_expr (input_location,
ifexp, 1,
- ret_val, NULL_TREE,
- ftree, NULL_TREE);
+ ret_val, NULL_TREE, input_location,
+ ftree, NULL_TREE, input_location);
#endif
}
return ret_val;
+2017-08-09 Marek Polacek <polacek@redhat.com>
+
+ PR c/81417
+ * Wsign-compare-1.c: New test.
+ * gcc.dg/compare1.c: Adjust dg-bogus.
+ * gcc.dg/compare2.c: Likewise.
+ * gcc.dg/compare3.c: Likewise.
+ * gcc.dg/compare7.c: Likewise.
+ * gcc.dg/compare8.c: Likewise.
+ * gcc.dg/compare9.c: Likewise.
+ * gcc.dg/pr11492.c: Likewise.
+
2017-08-08 H.J. Lu <hongjiu.lu@intel.com>
PR driver/81523
--- /dev/null
+/* PR c/81417 */
+/* { dg-do compile } */
+/* { dg-options "-Wsign-compare -fdiagnostics-show-caret" } */
+
+unsigned int
+f0 (int x, unsigned int y)
+{
+ return x ? y : -1; /* { dg-warning "18:operand of \\?: changes signedness from 'int' to 'unsigned int'" } */
+/* { dg-begin-multiline-output "" }
+ return x ? y : -1;
+ ^~
+ { dg-end-multiline-output "" } */
+}
+
+unsigned int
+f1 (int xxx, unsigned int yyy)
+{
+ return xxx ? yyy : -1; /* { dg-warning "22:operand of \\?: changes signedness from 'int' to 'unsigned int'" } */
+/* { dg-begin-multiline-output "" }
+ return xxx ? yyy : -1;
+ ^~
+ { dg-end-multiline-output "" } */
+}
+
+unsigned int
+f2 (int xxx, unsigned int yyy)
+{
+ return xxx ? -1 : yyy; /* { dg-warning "16:operand of \\?: changes signedness from 'int' to 'unsigned int'" } */
+/* { dg-begin-multiline-output "" }
+ return xxx ? -1 : yyy;
+ ^~
+ { dg-end-multiline-output "" } */
+}
+
+unsigned int
+f3 (unsigned int yyy)
+{
+ return yyy ?: -1; /* { dg-warning "17:operand of \\?: changes signedness from 'int' to 'unsigned int'" } */
+/* { dg-begin-multiline-output "" }
+ return yyy ?: -1;
+ ^~
+ { dg-end-multiline-output "" } */
+}
+
+unsigned int
+f4 (int xxx, unsigned yyy, short uuu)
+{
+ return xxx ? yyy : uuu; /* { dg-warning "22:operand of \\?: changes signedness from 'short int' to 'unsigned int'" } */
+/* { dg-begin-multiline-output "" }
+ return xxx ? yyy : uuu;
+ ^~~
+ { dg-end-multiline-output "" } */
+}
+
+unsigned int
+f5 (int xxx, unsigned yyy, short uuu)
+{
+ return xxx ? uuu : yyy; /* { dg-warning "16:operand of \\?: changes signedness from 'short int' to 'unsigned int'" } */
+/* { dg-begin-multiline-output "" }
+ return xxx ? uuu : yyy;
+ ^~~
+ { dg-end-multiline-output "" } */
+}
+
+unsigned int
+f6 (int xxx, unsigned yyy, signed char uuu)
+{
+ return xxx ? yyy : uuu; /* { dg-warning "22:operand of \\?: changes signedness from 'signed char' to 'unsigned int'" } */
+/* { dg-begin-multiline-output "" }
+ return xxx ? yyy : uuu;
+ ^~~
+ { dg-end-multiline-output "" } */
+}
+
+unsigned int
+f7 (int xxx, unsigned yyy, signed char uuu)
+{
+ return xxx ? uuu : yyy; /* { dg-warning "16:operand of \\?: changes signedness from 'signed char' to 'unsigned int'" } */
+/* { dg-begin-multiline-output "" }
+ return xxx ? uuu : yyy;
+ ^~~
+ { dg-end-multiline-output "" } */
+}
int f(enum mm1 x)
{
- return x == (tf?DI:SI); /* { dg-bogus "signed and unsigned" "case 1" } */
+ return x == (tf?DI:SI); /* { dg-bogus "changes signedness" "case 1" } */
}
int g(enum mm1 x)
{
- return x == (tf?DI:-1); /* { dg-bogus "signed and unsigned" "case 2" } */
+ return x == (tf?DI:-1); /* { dg-bogus "changes signedness" "case 2" } */
}
int h(enum mm2 x)
{
- return x == (tf?DI2:SI2); /* { dg-bogus "signed and unsigned" "case 3" } */
+ return x == (tf?DI2:SI2); /* { dg-bogus "changes signedness" "case 3" } */
}
int i(enum mm2 x)
void f(int x, unsigned int y)
{
/* ?: branches are constants. */
- x > (tf?64:128); /* { dg-bogus "signed and unsigned" "case 1" } */
- y > (tf?64:128); /* { dg-bogus "signed and unsigned" "case 2" } */
+ x > (tf?64:128); /* { dg-bogus "changes signedness" "case 1" } */
+ y > (tf?64:128); /* { dg-bogus "changes signedness" "case 2" } */
/* ?: branches are (recursively) constants. */
- x > (tf?64:(tf?128:256)); /* { dg-bogus "signed and unsigned" "case 3" } */
- y > (tf?64:(tf?128:256)); /* { dg-bogus "signed and unsigned" "case 4" } */
+ x > (tf?64:(tf?128:256)); /* { dg-bogus "changes signedness" "case 3" } */
+ y > (tf?64:(tf?128:256)); /* { dg-bogus "changes signedness" "case 4" } */
/* ?: branches are signed constants. */
- x > (tf?64:-1); /* { dg-bogus "signed and unsigned" "case 5" } */
+ x > (tf?64:-1); /* { dg-bogus "changes signedness" "case 5" } */
y > (tf?64:-1); /* { dg-warning "different signedness" "case 6" } */
/* ?: branches are (recursively) signed constants. */
- x > (tf?64:(tf?128:-1)); /* { dg-bogus "signed and unsigned" "case 7" } */
+ x > (tf?64:(tf?128:-1)); /* { dg-bogus "changes signedness" "case 7" } */
y > (tf?64:(tf?128:-1)); /* { dg-warning "different signedness" "case 8" } */
/* Statement expression. */
- x > ({tf; 64;}); /* { dg-bogus "signed and unsigned" "case 9" } */
- y > ({tf; 64;}); /* { dg-bogus "signed and unsigned" "case 10" } */
+ x > ({tf; 64;}); /* { dg-bogus "changes signedness" "case 9" } */
+ y > ({tf; 64;}); /* { dg-bogus "changes signedness" "case 10" } */
/* Statement expression with recursive ?: . */
- x > ({tf; tf?64:(tf?128:256);}); /* { dg-bogus "signed and unsigned" "case 11" } */
- y > ({tf; tf?64:(tf?128:256);}); /* { dg-bogus "signed and unsigned" "case 12" } */
+ x > ({tf; tf?64:(tf?128:256);}); /* { dg-bogus "changes signedness" "case 11" } */
+ y > ({tf; tf?64:(tf?128:256);}); /* { dg-bogus "changes signedness" "case 12" } */
/* Statement expression with signed ?:. */
- x > ({tf; tf?64:-1;}); /* { dg-bogus "signed and unsigned" "case 13" } */
+ x > ({tf; tf?64:-1;}); /* { dg-bogus "changes signedness" "case 13" } */
y > ({tf; tf?64:-1;}); /* { dg-warning "different signedness" "case 14" } */
/* Statement expression with recursive signed ?:. */
- x > ({tf; tf?64:(tf?128:-1);}); /* { dg-bogus "signed and unsigned" "case 15" } */
+ x > ({tf; tf?64:(tf?128:-1);}); /* { dg-bogus "changes signedness" "case 15" } */
y > ({tf; tf?64:(tf?128:-1);}); /* { dg-warning "different signedness" "case 16" } */
/* ?: branches are constants. */
/* Test comparing conditional expressions containing truth values.
This can occur explicitly, or e.g. when (foo?2:(bar?1:0)) is
optimized into (foo?2:(bar!=0)). */
- x > (tf?64:(tf!=x)); /* { dg-bogus "signed and unsigned" "case 1" } */
- y > (tf?64:(tf!=x)); /* { dg-bogus "signed and unsigned" "case 2" } */
- x > (tf?(tf!=x):64); /* { dg-bogus "signed and unsigned" "case 3" } */
- y > (tf?(tf!=x):64); /* { dg-bogus "signed and unsigned" "case 4" } */
-
- x > (tf?64:(tf==x)); /* { dg-bogus "signed and unsigned" "case 5" } */
- y > (tf?64:(tf==x)); /* { dg-bogus "signed and unsigned" "case 6" } */
- x > (tf?(tf==x):64); /* { dg-bogus "signed and unsigned" "case 7" } */
- y > (tf?(tf==x):64); /* { dg-bogus "signed and unsigned" "case 8" } */
-
- x > (tf?64:(tf>x)); /* { dg-bogus "signed and unsigned" "case 9" } */
- y > (tf?64:(tf>x)); /* { dg-bogus "signed and unsigned" "case 10" } */
- x > (tf?(tf>x):64); /* { dg-bogus "signed and unsigned" "case 11" } */
- y > (tf?(tf>x):64); /* { dg-bogus "signed and unsigned" "case 12" } */
-
- x < (tf?64:(tf<x)); /* { dg-bogus "signed and unsigned" "case 13" } */
- y < (tf?64:(tf<x)); /* { dg-bogus "signed and unsigned" "case 14" } */
- x < (tf?(tf<x):64); /* { dg-bogus "signed and unsigned" "case 15" } */
- y < (tf?(tf<x):64); /* { dg-bogus "signed and unsigned" "case 16" } */
-
- x > (tf?64:(tf>=x)); /* { dg-bogus "signed and unsigned" "case 17" } */
- y > (tf?64:(tf>=x)); /* { dg-bogus "signed and unsigned" "case 18" } */
- x > (tf?(tf>=x):64); /* { dg-bogus "signed and unsigned" "case 19" } */
- y > (tf?(tf>=x):64); /* { dg-bogus "signed and unsigned" "case 20" } */
-
- x > (tf?64:(tf<=x)); /* { dg-bogus "signed and unsigned" "case 21" } */
- y > (tf?64:(tf<=x)); /* { dg-bogus "signed and unsigned" "case 22" } */
- x > (tf?(tf<=x):64); /* { dg-bogus "signed and unsigned" "case 23" } */
- y > (tf?(tf<=x):64); /* { dg-bogus "signed and unsigned" "case 24" } */
-
- x > (tf?64:(tf&&x)); /* { dg-bogus "signed and unsigned" "case 25" } */
- y > (tf?64:(tf&&x)); /* { dg-bogus "signed and unsigned" "case 26" } */
- x > (tf?(tf&&x):64); /* { dg-bogus "signed and unsigned" "case 27" } */
- y > (tf?(tf&&x):64); /* { dg-bogus "signed and unsigned" "case 28" } */
-
- x > (tf?64:(tf||x)); /* { dg-bogus "signed and unsigned" "case 29" } */
- y > (tf?64:(tf||x)); /* { dg-bogus "signed and unsigned" "case 30" } */
- x > (tf?(tf||x):64); /* { dg-bogus "signed and unsigned" "case 31" } */
- y > (tf?(tf||x):64); /* { dg-bogus "signed and unsigned" "case 32" } */
-
- x > (tf?64:(!tf)); /* { dg-bogus "signed and unsigned" "case 33" } */
- y > (tf?64:(!tf)); /* { dg-bogus "signed and unsigned" "case 34" } */
- x > (tf?(!tf):64); /* { dg-bogus "signed and unsigned" "case 35" } */
- y > (tf?(!tf):64); /* { dg-bogus "signed and unsigned" "case 36" } */
+ x > (tf?64:(tf!=x)); /* { dg-bogus "changes signedness" "case 1" } */
+ y > (tf?64:(tf!=x)); /* { dg-bogus "changes signedness" "case 2" } */
+ x > (tf?(tf!=x):64); /* { dg-bogus "changes signedness" "case 3" } */
+ y > (tf?(tf!=x):64); /* { dg-bogus "changes signedness" "case 4" } */
+
+ x > (tf?64:(tf==x)); /* { dg-bogus "changes signedness" "case 5" } */
+ y > (tf?64:(tf==x)); /* { dg-bogus "changes signedness" "case 6" } */
+ x > (tf?(tf==x):64); /* { dg-bogus "changes signedness" "case 7" } */
+ y > (tf?(tf==x):64); /* { dg-bogus "changes signedness" "case 8" } */
+
+ x > (tf?64:(tf>x)); /* { dg-bogus "changes signedness" "case 9" } */
+ y > (tf?64:(tf>x)); /* { dg-bogus "changes signedness" "case 10" } */
+ x > (tf?(tf>x):64); /* { dg-bogus "changes signedness" "case 11" } */
+ y > (tf?(tf>x):64); /* { dg-bogus "changes signedness" "case 12" } */
+
+ x < (tf?64:(tf<x)); /* { dg-bogus "changes signedness" "case 13" } */
+ y < (tf?64:(tf<x)); /* { dg-bogus "changes signedness" "case 14" } */
+ x < (tf?(tf<x):64); /* { dg-bogus "changes signedness" "case 15" } */
+ y < (tf?(tf<x):64); /* { dg-bogus "changes signedness" "case 16" } */
+
+ x > (tf?64:(tf>=x)); /* { dg-bogus "changes signedness" "case 17" } */
+ y > (tf?64:(tf>=x)); /* { dg-bogus "changes signedness" "case 18" } */
+ x > (tf?(tf>=x):64); /* { dg-bogus "changes signedness" "case 19" } */
+ y > (tf?(tf>=x):64); /* { dg-bogus "changes signedness" "case 20" } */
+
+ x > (tf?64:(tf<=x)); /* { dg-bogus "changes signedness" "case 21" } */
+ y > (tf?64:(tf<=x)); /* { dg-bogus "changes signedness" "case 22" } */
+ x > (tf?(tf<=x):64); /* { dg-bogus "changes signedness" "case 23" } */
+ y > (tf?(tf<=x):64); /* { dg-bogus "changes signedness" "case 24" } */
+
+ x > (tf?64:(tf&&x)); /* { dg-bogus "changes signedness" "case 25" } */
+ y > (tf?64:(tf&&x)); /* { dg-bogus "changes signedness" "case 26" } */
+ x > (tf?(tf&&x):64); /* { dg-bogus "changes signedness" "case 27" } */
+ y > (tf?(tf&&x):64); /* { dg-bogus "changes signedness" "case 28" } */
+
+ x > (tf?64:(tf||x)); /* { dg-bogus "changes signedness" "case 29" } */
+ y > (tf?64:(tf||x)); /* { dg-bogus "changes signedness" "case 30" } */
+ x > (tf?(tf||x):64); /* { dg-bogus "changes signedness" "case 31" } */
+ y > (tf?(tf||x):64); /* { dg-bogus "changes signedness" "case 32" } */
+
+ x > (tf?64:(!tf)); /* { dg-bogus "changes signedness" "case 33" } */
+ y > (tf?64:(!tf)); /* { dg-bogus "changes signedness" "case 34" } */
+ x > (tf?(!tf):64); /* { dg-bogus "changes signedness" "case 35" } */
+ y > (tf?(!tf):64); /* { dg-bogus "changes signedness" "case 36" } */
}
int f(unsigned a, int b)
{
- return a < b; /* { dg-bogus "signed and unsigned" } */
+ return a < b; /* { dg-bogus "changes signedness" } */
}
int
f(unsigned short a1, unsigned short a2, unsigned int b)
{
- return ((a1+a2)|5) > b ? 2 : 3; /* { dg-bogus "signed and unsigned" } */
+ return ((a1+a2)|5) > b ? 2 : 3; /* { dg-bogus "changes signedness" } */
}
int
g(unsigned short a1, unsigned short a2, unsigned int b)
{
- return ((a1+a2)&5) > b ? 2 : 3; /* { dg-bogus "signed and unsigned" } */
+ return ((a1+a2)&5) > b ? 2 : 3; /* { dg-bogus "changes signedness" } */
}
int
h(unsigned short a1, unsigned short a2, unsigned int b)
{
- return ((a1+a2)^5) > b ? 2 : 3; /* { dg-bogus "signed and unsigned" } */
+ return ((a1+a2)^5) > b ? 2 : 3; /* { dg-bogus "changes signedness" } */
}
int f(enum mm1 x)
{
- return x == (tf?DI:SI); /* { dg-bogus "signed and unsigned" "case 1" } */
+ return x == (tf?DI:SI); /* { dg-bogus "changes signedness" "case 1" } */
}
int g(enum mm1 x)
{
- return x == (tf?DI:-1); /* { dg-bogus "signed and unsigned" "case 2" } */
+ return x == (tf?DI:-1); /* { dg-bogus "changes signedness" "case 2" } */
}
int h(enum mm2 x)
{
- return x == (tf?DI2:SI2); /* { dg-bogus "signed and unsigned" "case 3" } */
+ return x == (tf?DI2:SI2); /* { dg-bogus "changes signedness" "case 3" } */
}
int i(enum mm2 x)
{
- return x == (tf?DI2:-1); /* { dg-bogus "signed and unsigned" "case 4" } */
+ return x == (tf?DI2:-1); /* { dg-bogus "changes signedness" "case 4" } */
}
{
unsigned int a;
unsigned char b;
- for ( a = 0, b = 2; a > b * 100; a++ ) /* { dg-bogus "comparison between signed and unsigned integer" } */
+ for ( a = 0, b = 2; a > b * 100; a++ ) /* { dg-bogus "comparison of integer expressions of different signedness" } */
{ ; }
return 0;