diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-11-16 20:49:57 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-11-16 20:49:57 +0000 |
commit | 6ef8d12f7e0db62100394a870efefae4c20f74f7 (patch) | |
tree | 94166703e70b79443946831b62354ecb2d897536 /gcc/c-family | |
parent | f4979459bd30c5ee03a268741629dcd48e9d99c3 (diff) | |
download | gcc-6ef8d12f7e0db62100394a870efefae4c20f74f7.tar.gz |
PR c++/46401
* c-common.c (warning_candidate_p): Don't track non-const calls
or STRING_CSTs.
* g++.dg/warn/Wsequence-point-3.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@166823 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-family')
-rw-r--r-- | gcc/c-family/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/c-family/c-common.c | 22 |
2 files changed, 25 insertions, 3 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 3af8ebeb5d6..57d3ab83374 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,9 @@ +2010-11-16 Jakub Jelinek <jakub@redhat.com> + + PR c++/46401 + * c-common.c (warning_candidate_p): Don't track non-const calls + or STRING_CSTs. + 2010-11-15 Ian Lance Taylor <iant@google.com> * c-lex.c (init_c_lex): Set macro debug callbacks if diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 7e716407508..afe9b9d6e19 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -2324,10 +2324,26 @@ warn_for_collisions (struct tlist *list) static int warning_candidate_p (tree x) { - /* !VOID_TYPE_P (TREE_TYPE (x)) is workaround for cp/tree.c + if (DECL_P (x) && DECL_ARTIFICIAL (x)) + return 0; + + /* VOID_TYPE_P (TREE_TYPE (x)) is workaround for cp/tree.c (lvalue_p) crash on TRY/CATCH. */ - return !(DECL_P (x) && DECL_ARTIFICIAL (x)) - && TREE_TYPE (x) && !VOID_TYPE_P (TREE_TYPE (x)) && lvalue_p (x); + if (TREE_TYPE (x) == NULL_TREE || VOID_TYPE_P (TREE_TYPE (x))) + return 0; + + if (!lvalue_p (x)) + return 0; + + /* No point to track non-const calls, they will never satisfy + operand_equal_p. */ + if (TREE_CODE (x) == CALL_EXPR && (call_expr_flags (x) & ECF_CONST) == 0) + return 0; + + if (TREE_CODE (x) == STRING_CST) + return 0; + + return 1; } /* Return nonzero if X and Y appear to be the same candidate (or NULL) */ |