re PR c++/35602 (Bogus warning with -Wsign-conversion)

2008-08-20  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>

	PR c++/35602
	* c-common.c (conversion_warning): Do not warn for artificial
	expressions.
testsuite/
	* g++.dg/warn/pr35602.C: New.

From-SVN: r139328
parent 73019a42
2008-08-20 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR c++/35602
* c-common.c (conversion_warning): Do not warn for artificial
expressions.
2008-08-20 Richard Guenther <rguenther@suse.de>
* tree-vrp.c (op_with_constant_singleton_value_range): New function.
......
......@@ -1556,11 +1556,22 @@ conversion_warning (tree type, tree expr)
{
bool give_warning = false;
int i;
const int expr_num_operands = TREE_OPERAND_LENGTH (expr);
tree expr_type = TREE_TYPE (expr);
if (!warn_conversion && !warn_sign_conversion)
return;
/* If any operand is artificial, then this expression was generated
by the compiler and we do not warn. */
for (i = 0; i < expr_num_operands; i++)
{
tree op = TREE_OPERAND (expr, i);
if (DECL_P (op) && DECL_ARTIFICIAL (op))
return;
}
switch (TREE_CODE (expr))
{
case EQ_EXPR:
......
2008-08-20 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR c++/35602
* g++.dg/warn/pr35602.C: New.
2008-08-20 Richard Guenther <rguenther@suse.de>
* gcc.dg/tree-ssa/pr21829.c: Scan optimized and cddce2 dumps
......
// PR 35602 Bogus warning with -Wsign-conversion
// { dg-do compile }
// { dg-options "-Wconversion -Wsign-conversion" }
struct c
{
~c();
c();
};
int
main(const int,
const char * const * const)
{
c x[0UL][0UL] = // { dg-bogus "warning: conversion to .long unsigned int. from .long int. may change the sign of the result" }
{
};
c y[0UL] =
{
};
int z[0ul][0UL] =
{
};
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment