diff options
author | Bernd Edlinger <bernd.edlinger@hotmail.de> | 2016-10-24 17:14:41 +0000 |
---|---|---|
committer | Bernd Edlinger <edlinger@gcc.gnu.org> | 2016-10-24 17:14:41 +0000 |
commit | f834806177042ee269333855dee99fda84bc7c26 (patch) | |
tree | 192f2356af6a042207d630b08e779de14912326f /gcc/testsuite | |
parent | 1eb4547b1058d6a4e1912ac0f15cc0a69bf4fd78 (diff) | |
download | gcc-f834806177042ee269333855dee99fda84bc7c26.zip gcc-f834806177042ee269333855dee99fda84bc7c26.tar.gz gcc-f834806177042ee269333855dee99fda84bc7c26.tar.bz2 |
c-common.c (c_common_truthvalue_conversion): Warn for multiplications in boolean context.
2016-10-24 Bernd Edlinger <bernd.edlinger@hotmail.de>
* c-common.c (c_common_truthvalue_conversion): Warn for
multiplications in boolean context. Fix the quoting of '<<' and '<'
in the shift warning.
gcc:
2016-10-24 Bernd Edlinger <bernd.edlinger@hotmail.de>
* doc/invoke.text (Wint-in-bool-context): Update documentation.
* value-prof.c (stringop_block_profile): Fix a warning.
testsuite:
2016-10-24 Bernd Edlinger <bernd.edlinger@hotmail.de>
* c-c++-common/Wint-in-bool-context-3.c: New test.
From-SVN: r241490
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/Wint-in-bool-context-3.c | 15 |
2 files changed, 19 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 28c7550..5b83f4d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2016-10-24 Bernd Edlinger <bernd.edlinger@hotmail.de> + + * c-c++-common/Wint-in-bool-context-3.c: New test. + 2016-10-24 Martin Sebor <msebor@redhat.com> PR middle-end/77735 diff --git a/gcc/testsuite/c-c++-common/Wint-in-bool-context-3.c b/gcc/testsuite/c-c++-common/Wint-in-bool-context-3.c new file mode 100644 index 0000000..869132a --- /dev/null +++ b/gcc/testsuite/c-c++-common/Wint-in-bool-context-3.c @@ -0,0 +1,15 @@ +/* { dg-options "-Wint-in-bool-context" } */ +/* { dg-do compile } */ + +#define BITS_PER_UNIT 8 + +int foo (int count) +{ + int alignment; + + alignment = 1; + while (!(count & alignment) + && (alignment * 2 * BITS_PER_UNIT)) /* { dg-warning "boolean context" } */ + alignment <<= 1; + return alignment * BITS_PER_UNIT; +} |