From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 123169 invoked by alias); 29 Sep 2016 20:38:37 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 122664 invoked by uid 89); 29 Sep 2016 20:38:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM autolearn=no version=3.3.2 spammy=berndedlingerhotmailde, bernd.edlinger@hotmail.de, UD:type_common.align, sk:intin X-HELO: mail-oi0-f50.google.com Received: from mail-oi0-f50.google.com (HELO mail-oi0-f50.google.com) (209.85.218.50) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 29 Sep 2016 20:38:26 +0000 Received: by mail-oi0-f50.google.com with SMTP id r126so107432337oib.0 for ; Thu, 29 Sep 2016 13:38:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Mi9OYz2PJ7pR0PDevPIWdZDdvAOjbZkptJ4tYEat1Yo=; b=E9XoyZpcFi7KdaSdHxpvPqJqL2U9uuJrW+FHASXPZvBigEc/Wg1IYcGHyrIcq/BEKI kCGsKict9ttxW6bUTErQdMV2wGkboLB3J7KdFTGvHeXL1Sfw8xQ/bwqwrblsvTfEApyt cjquEu6fXy5YLDzIJpRmwGCMnFt9RhqmmwBVpsqIVK5qw759Q56OFZpUP4aJqX+dmVX8 rkUiZ7bjp126qdcKUTthUXWTKfoGRZpghIVBJc0wr2HtnH1qE5FpQVMAMActx0xL7yPT cX+jg/hyL+wwOfYmqSC8hIufnuLeT0V4qZewnnabv4zq9kdbgT4myXnRydQK57YQCwRd cpmw== X-Gm-Message-State: AA6/9Rmg0FhEZRcHByi8kblx4g4jvtIg0vLqaCOHbGJ+cWBKdqiW9PKLrupyulOvnaqaoYAn5jqa/V9QUAQuGjlN X-Received: by 10.202.243.194 with SMTP id r185mr3325875oih.12.1475181505037; Thu, 29 Sep 2016 13:38:25 -0700 (PDT) MIME-Version: 1.0 Received: by 10.182.105.167 with HTTP; Thu, 29 Sep 2016 13:38:04 -0700 (PDT) In-Reply-To: References: <87shslv769.fsf@mid.deneb.enyo.de> <87fuol77ri.fsf@mid.deneb.enyo.de> From: Jason Merrill Date: Thu, 29 Sep 2016 20:53:00 -0000 Message-ID: Subject: Re: [PATCH] Make -Wint-in-bool-context warn on suspicious shift ops To: Bernd Edlinger Cc: Florian Weimer , "gcc-patches@gcc.gnu.org" , Jeff Law Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2016-09/txt/msg02296.txt.bz2 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 > 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. Jason