diff options
author | Jakub Jelinek <jakub@redhat.com> | 2016-02-11 23:55:02 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2016-02-11 23:55:02 +0100 |
commit | 66756373c1940650568173b6d9c32325429bfc34 (patch) | |
tree | 77d4fdb0a1276a8329dd63f42ddb790207c0364b /gcc/c | |
parent | ec4836a75da03d1b93df6a9dff3da3b597676ed9 (diff) | |
download | gcc-66756373c1940650568173b6d9c32325429bfc34.zip gcc-66756373c1940650568173b6d9c32325429bfc34.tar.gz gcc-66756373c1940650568173b6d9c32325429bfc34.tar.bz2 |
re PR c/69768 (Bogus -Waddress warning)
PR c/69768
* c-typeck.c (parser_build_binary_op): Strip nops from integer_zerop
arguments for -Waddress warning.
* typeck.c (cp_build_binary_op): cp_fully_fold integer_zerop
arguments for -Waddress warning. Fix up formatting.
* c-c++-common/Waddress-1.c: New test.
From-SVN: r233357
Diffstat (limited to 'gcc/c')
-rw-r--r-- | gcc/c/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/c/c-typeck.c | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 931e51d..b595b81 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,9 @@ +2016-02-11 Jakub Jelinek <jakub@redhat.com> + + PR c/69768 + * c-typeck.c (parser_build_binary_op): Strip nops from integer_zerop + arguments for -Waddress warning. + 2016-02-04 Jakub Jelinek <jakub@redhat.com> PR c/69669 diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index 65925cb..82efacf 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -3597,8 +3597,10 @@ parser_build_binary_op (location_t location, enum tree_code code, of testing for equality or inequality of a string literal with NULL. */ if (code == EQ_EXPR || code == NE_EXPR) { - if ((code1 == STRING_CST && !integer_zerop (arg2.value)) - || (code2 == STRING_CST && !integer_zerop (arg1.value))) + if ((code1 == STRING_CST + && !integer_zerop (tree_strip_nop_conversions (arg2.value))) + || (code2 == STRING_CST + && !integer_zerop (tree_strip_nop_conversions (arg1.value)))) warning_at (location, OPT_Waddress, "comparison with string literal results in unspecified behavior"); } |