diff options
author | Manuel López-Ibáñez <manu@gcc.gnu.org> | 2008-08-20 16:05:58 +0000 |
---|---|---|
committer | Manuel López-Ibáñez <manu@gcc.gnu.org> | 2008-08-20 16:05:58 +0000 |
commit | 0011dedbd9dbfa01b2f4d3390ef3ed2d6ea1dd6d (patch) | |
tree | 4118ccc91f98aed95bebab381ba860beed6cf709 /gcc/c-common.c | |
parent | 73019a428f45b47ebae03a759afd7f3501c165db (diff) | |
download | gcc-0011dedbd9dbfa01b2f4d3390ef3ed2d6ea1dd6d.zip gcc-0011dedbd9dbfa01b2f4d3390ef3ed2d6ea1dd6d.tar.gz gcc-0011dedbd9dbfa01b2f4d3390ef3ed2d6ea1dd6d.tar.bz2 |
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
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r-- | gcc/c-common.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c index 639601d..92e58c9 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -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: |