This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


OK.

On Fri, Sep 30, 2016 at 1:07 AM, Bernd Edlinger
<bernd.edlinger@hotmail.de> wrote:
> On 09/29/16 22:38, Jason Merrill wrote:
>> On Thu, Sep 29, 2016 at 3:58 PM, Bernd Edlinger
>> <bernd.edlinger@hotmail.de> 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
>>> adjust_packed(tree, tree, int)':
>>> ../../gcc-trunk/gcc/tree.h:1874:22: error: << on signed integer in
>>> boolean context [-Werror=int-in-bool-context]
>>>         ? ((unsigned)1) << ((NODE)->type_common.align - 1) : 0)
>>>           ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>
>> Ah, this issue again: the shift isn't in boolean context, it's in
>> integer context.  I think we want to be a lot more conservative about
>> these warnings in the arms of a COND_EXPR.  In fact, I think the
>> entire
>>
>>        /* Distribute the conversion into the arms of a COND_EXPR.  */
>>
>> section is wrong now that we're doing delayed folding.
>>
>
> Could you take care of this ?
>
>
> For the warning, I think I can suppress it just while
> the recursing into the condition arms.
>
> As in this updated patch.
>
> Is it OK?
>
>
> Bernd.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]