Re: [PATCH] Make -Wint-in-bool-context warn on suspicious shift ops

2016-10-20 Thread Bernd Edlinger
On 10/20/16 10:05, Markus Trippelsdorf wrote: > > Thanks for the commit. But I think the comment is wrong: > > + /* We will only warn on unsigned shifts here, because the majority of >^^ > This should be »signed«. > Oops. Thanks for noticing. This is what I

Re: [PATCH] Make -Wint-in-bool-context warn on suspicious shift ops

2016-10-20 Thread Markus Trippelsdorf
On 2016.10.19 at 14:13 -0600, Jeff Law wrote: > On 10/18/2016 12:14 PM, Bernd Edlinger wrote: > > On 10/18/16 19:05, Joseph Myers wrote: > > > > On Tue, 18 Oct 2016, Bernd Edlinger wrote: > > > > > > > > >> Hi, > > > > >> > > > > >> this restricts the -Wint-in-bool-context warning to signed

Re: [PATCH] Make -Wint-in-bool-context warn on suspicious shift ops

2016-10-19 Thread Jeff Law
On 10/18/2016 12:14 PM, Bernd Edlinger wrote: On 10/18/16 19:05, Joseph Myers wrote: > On Tue, 18 Oct 2016, Bernd Edlinger wrote: > >> Hi, >> >> this restricts the -Wint-in-bool-context warning to signed shifts, >> to reduce the number of false positives Markus reported yesterday. > > This

Re: [PATCH] Make -Wint-in-bool-context warn on suspicious shift ops

2016-10-18 Thread Bernd Edlinger
On 10/18/16 19:05, Joseph Myers wrote: > On Tue, 18 Oct 2016, Bernd Edlinger wrote: > >> Hi, >> >> this restricts the -Wint-in-bool-context warning to signed shifts, >> to reduce the number of false positives Markus reported yesterday. > > This patch seems to be missing testcases (that warned

Re: [PATCH] Make -Wint-in-bool-context warn on suspicious shift ops

2016-10-18 Thread Joseph Myers
On Tue, 18 Oct 2016, Bernd Edlinger wrote: > Hi, > > this restricts the -Wint-in-bool-context warning to signed shifts, > to reduce the number of false positives Markus reported yesterday. This patch seems to be missing testcases (that warned before the patch and don't warn after it). --

Re: [PATCH] Make -Wint-in-bool-context warn on suspicious shift ops

2016-10-18 Thread Bernd Edlinger
Hi, this restricts the -Wint-in-bool-context warning to signed shifts, to reduce the number of false positives Markus reported yesterday. Bootstrap and reg-testing on x86_64-pc-linux-gnu was fine. Is it OK for trunk? Thanks Bernd. 2016-10-17 Bernd Edlinger *

Re: [PATCH] Make -Wint-in-bool-context warn on suspicious shift ops

2016-10-17 Thread Markus Trippelsdorf
On 2016.10.17 at 17:30 +, Bernd Edlinger wrote: > On 10/17/16 19:11, Markus Trippelsdorf wrote: > >>> I'm seeing this warning a lot in valid low level C code for unsigned > >>> integers. And I must say it look bogus in this context. Some examples: > > > > (All these examples are from qemu

Re: [PATCH] Make -Wint-in-bool-context warn on suspicious shift ops

2016-10-17 Thread Bernd Edlinger
On 10/17/16 19:11, Markus Trippelsdorf wrote: >>> I'm seeing this warning a lot in valid low level C code for unsigned >>> integers. And I must say it look bogus in this context. Some examples: > > (All these examples are from qemu trunk.) > >>> return ((a.high & 0x7fff) == 0x7fff) && (a.low<<1);

Re: [PATCH] Make -Wint-in-bool-context warn on suspicious shift ops

2016-10-17 Thread Markus Trippelsdorf
On 2016.10.17 at 16:51 +, Bernd Edlinger wrote: > On 10/17/16 17:23, Markus Trippelsdorf wrote: > > On 2016.09.29 at 18:52 +, Bernd Edlinger wrote: > >> On 09/29/16 20:03, Jason Merrill wrote: > >>> On Wed, Sep 28, 2016 at 12:09 PM, Bernd Edlinger > >>> wrote: >

Re: [PATCH] Make -Wint-in-bool-context warn on suspicious shift ops

2016-10-17 Thread Bernd Edlinger
On 10/17/16 17:23, Markus Trippelsdorf wrote: > On 2016.09.29 at 18:52 +, Bernd Edlinger wrote: >> On 09/29/16 20:03, Jason Merrill wrote: >>> On Wed, Sep 28, 2016 at 12:09 PM, Bernd Edlinger >>> wrote: On 09/28/16 16:41, Jason Merrill wrote: > On Tue, Sep

Re: [PATCH] Make -Wint-in-bool-context warn on suspicious shift ops

2016-10-17 Thread Markus Trippelsdorf
On 2016.09.29 at 18:52 +, Bernd Edlinger wrote: > On 09/29/16 20:03, Jason Merrill wrote: > > On Wed, Sep 28, 2016 at 12:09 PM, Bernd Edlinger > > wrote: > >> On 09/28/16 16:41, Jason Merrill wrote: > >>> On Tue, Sep 27, 2016 at 11:10 AM, Bernd Edlinger > >>>

Re: [PATCH] Make -Wint-in-bool-context warn on suspicious shift ops

2016-10-08 Thread Jason Merrill
On Sat, Oct 8, 2016 at 4:05 PM, Bernd Edlinger wrote: > On 10/08/16 19:40, Jason Merrill wrote: >> On Fri, Sep 30, 2016 at 1:07 AM, Bernd Edlinger >> wrote: >>> On 09/29/16 22:38, Jason Merrill wrote: On Thu, Sep 29, 2016 at 3:58 PM,

Re: [PATCH] Make -Wint-in-bool-context warn on suspicious shift ops

2016-10-08 Thread Bernd Edlinger
On 10/08/16 19:40, Jason Merrill wrote: > On Fri, Sep 30, 2016 at 1:07 AM, Bernd Edlinger > wrote: >> On 09/29/16 22:38, Jason Merrill wrote: >>> On Thu, Sep 29, 2016 at 3:58 PM, Bernd Edlinger >>> wrote: Unfortunately, without that

Re: [PATCH] Make -Wint-in-bool-context warn on suspicious shift ops

2016-10-08 Thread Jason Merrill
On Fri, Sep 30, 2016 at 1:07 AM, Bernd Edlinger wrote: > On 09/29/16 22:38, Jason Merrill wrote: >> On Thu, Sep 29, 2016 at 3:58 PM, Bernd Edlinger >> wrote: >>> Unfortunately, without that exception there is a false positive: >>> >>> In file

Re: [PATCH] Make -Wint-in-bool-context warn on suspicious shift ops

2016-10-02 Thread Jason Merrill
OK. On Fri, Sep 30, 2016 at 1:07 AM, Bernd Edlinger wrote: > On 09/29/16 22:38, Jason Merrill wrote: >> On Thu, Sep 29, 2016 at 3:58 PM, Bernd Edlinger >> wrote: >>> Unfortunately, without that exception there is a false positive: >>> >>> In

Re: [PATCH] Make -Wint-in-bool-context warn on suspicious shift ops

2016-09-29 Thread Bernd Edlinger
On 09/29/16 22:38, Jason Merrill wrote: > On Thu, Sep 29, 2016 at 3:58 PM, Bernd Edlinger > wrote: >> Unfortunately, without that exception there is a false positive: >> >> In file included from ../../gcc-trunk/gcc/ada/gcc-interface/decl.c:30:0: >>

Re: [PATCH] Make -Wint-in-bool-context warn on suspicious shift ops

2016-09-29 Thread Jason Merrill
On Thu, Sep 29, 2016 at 3:58 PM, Bernd Edlinger wrote: > Unfortunately, without that exception there is a false positive: > > In file included from ../../gcc-trunk/gcc/ada/gcc-interface/decl.c:30:0: > ../../gcc-trunk/gcc/ada/gcc-interface/decl.c: In function 'int >

Re: [PATCH] Make -Wint-in-bool-context warn on suspicious shift ops

2016-09-29 Thread Bernd Edlinger
On 09/29/16 20:52, Bernd Edlinger wrote: > On 09/29/16 20:03, Jason Merrill wrote: >> >> What do you think about dropping the TYPE_UNSIGNED exception as well? >> I don't see what difference that makes. >> > > > If I drop that exception, then I could also drop the check for > INTEGER_TYPE and the

Re: [PATCH] Make -Wint-in-bool-context warn on suspicious shift ops

2016-09-29 Thread Bernd Edlinger
On 09/29/16 20:03, Jason Merrill wrote: > On Wed, Sep 28, 2016 at 12:09 PM, Bernd Edlinger > wrote: >> On 09/28/16 16:41, Jason Merrill wrote: >>> On Tue, Sep 27, 2016 at 11:10 AM, Bernd Edlinger >>> wrote: On 09/27/16 16:42, Jason

Re: [PATCH] Make -Wint-in-bool-context warn on suspicious shift ops

2016-09-29 Thread Jason Merrill
On Wed, Sep 28, 2016 at 12:09 PM, Bernd Edlinger wrote: > On 09/28/16 16:41, Jason Merrill wrote: >> On Tue, Sep 27, 2016 at 11:10 AM, Bernd Edlinger >> wrote: >>> On 09/27/16 16:42, Jason Merrill wrote: On Tue, Sep 27, 2016 at 10:28 AM,

Re: [PATCH] Make -Wint-in-bool-context warn on suspicious shift ops

2016-09-28 Thread Bernd Edlinger
On 09/28/16 16:41, Jason Merrill wrote: > On Tue, Sep 27, 2016 at 11:10 AM, Bernd Edlinger > wrote: >> On 09/27/16 16:42, Jason Merrill wrote: >>> On Tue, Sep 27, 2016 at 10:28 AM, Bernd Edlinger >>> wrote: On 09/27/16 16:10, Florian

Re: [PATCH] Make -Wint-in-bool-context warn on suspicious shift ops

2016-09-28 Thread Jason Merrill
On Tue, Sep 27, 2016 at 11:10 AM, Bernd Edlinger wrote: > On 09/27/16 16:42, Jason Merrill wrote: >> On Tue, Sep 27, 2016 at 10:28 AM, Bernd Edlinger >> wrote: >>> On 09/27/16 16:10, Florian Weimer wrote: * Bernd Edlinger: >> “0

Re: [PATCH] Make -Wint-in-bool-context warn on suspicious shift ops

2016-09-27 Thread Bernd Edlinger
On 09/27/16 16:42, Jason Merrill wrote: > On Tue, Sep 27, 2016 at 10:28 AM, Bernd Edlinger > wrote: >> On 09/27/16 16:10, Florian Weimer wrote: >>> * Bernd Edlinger: >>> > “0 << 0” is used in a similar context, to create a zero constant for a > multi-bit

Re: [PATCH] Make -Wint-in-bool-context warn on suspicious shift ops

2016-09-27 Thread Jason Merrill
On Tue, Sep 27, 2016 at 10:28 AM, Bernd Edlinger wrote: > On 09/27/16 16:10, Florian Weimer wrote: >> * Bernd Edlinger: >> “0 << 0” is used in a similar context, to create a zero constant for a multi-bit subfield of an integer. This example comes

Re: [PATCH] Make -Wint-in-bool-context warn on suspicious shift ops

2016-09-27 Thread Bernd Edlinger
On 09/27/16 16:10, Florian Weimer wrote: > * Bernd Edlinger: > >>> “0 << 0” is used in a similar context, to create a zero constant for a >>> multi-bit subfield of an integer. >>> >>> This example comes from GDB, in bfd/elf64-alpha.c: >>> >>> | insn = INSN_ADDQ | (16 << 21) | (0 << 16) | (0 <<

Re: [PATCH] Make -Wint-in-bool-context warn on suspicious shift ops

2016-09-27 Thread Florian Weimer
* Bernd Edlinger: >> “0 << 0” is used in a similar context, to create a zero constant for a >> multi-bit subfield of an integer. >> >> This example comes from GDB, in bfd/elf64-alpha.c: >> >> | insn = INSN_ADDQ | (16 << 21) | (0 << 16) | (0 << 0); >> > > Of course that is not a boolean context,

Re: [PATCH] Make -Wint-in-bool-context warn on suspicious shift ops

2016-09-27 Thread Bernd Edlinger
On 09/27/16 14:49, Florian Weimer wrote: > * Jason Merrill: > >> On Sun, Sep 25, 2016 at 3:46 AM, Bernd Edlinger >> wrote: >>> This patch makes -Wint-in-bool-context warn on suspicious integer left >>> shifts, when the integer is signed, which is most likely some kind

Re: [PATCH] Make -Wint-in-bool-context warn on suspicious shift ops

2016-09-27 Thread Michael Matz
Hi, On Tue, 27 Sep 2016, Jason Merrill wrote: > On Sun, Sep 25, 2016 at 3:46 AM, Bernd Edlinger > wrote: > > This patch makes -Wint-in-bool-context warn on suspicious integer left > > shifts, when the integer is signed, which is most likely some kind of > >

Re: [PATCH] Make -Wint-in-bool-context warn on suspicious shift ops

2016-09-27 Thread Florian Weimer
* Jason Merrill: > On Sun, Sep 25, 2016 at 3:46 AM, Bernd Edlinger > wrote: >> This patch makes -Wint-in-bool-context warn on suspicious integer left >> shifts, when the integer is signed, which is most likely some kind of >> programming error, for instance using "<<"

Re: [PATCH] Make -Wint-in-bool-context warn on suspicious shift ops

2016-09-27 Thread Jason Merrill
On Sun, Sep 25, 2016 at 3:46 AM, Bernd Edlinger wrote: > This patch makes -Wint-in-bool-context warn on suspicious integer left > shifts, when the integer is signed, which is most likely some kind of > programming error, for instance using "<<" instead of "<". > > The