From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32646 invoked by alias); 20 Feb 2018 15:15:34 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 15382 invoked by uid 89); 20 Feb 2018 15:15:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-it0-f41.google.com Received: from mail-it0-f41.google.com (HELO mail-it0-f41.google.com) (209.85.214.41) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 20 Feb 2018 15:15:22 +0000 Received: by mail-it0-f41.google.com with SMTP id l187so13486936ith.4 for ; Tue, 20 Feb 2018 07:15:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=lAp+2p9pGJszWhZhy5Dh1FVWsQ/gUzHfxCWT/SIB49k=; b=n3dfcvjYbsVy0gvZYVlGm0rLE/4823qSeZ1XFPk+n8Xm3aHx9K6PFuJ7pJuT45cQeo Y/sfYO1BYvUuqsJS5SiwZiGPd8RGhrRL43jDdMPyg9CqlCHfMjGuHKDuBfQo7eK/jSTK D1+60Drwueuj5jPfxl2hZqcBDi/DTDwk79ThiCgFmB+gYH3ZrwqqZ8sDs1SQbiXt5sZ/ 7GBkN1e9uMD4wyfC9O/kB5IVYvGm/Daqln0gTlhugAmujmkQMrgIgMeKUvIHs9+qtVDd v1gmgbkhx//taVCNkvw/QkAMNQjDmHmukKSzOuZ6yW6Kp4QRrQjTIwf2Qt/g1p3AvVBh nvWQ== X-Gm-Message-State: APf1xPArcsg8f+RlzUhksHz/zciIruJg1G/NvnVXUcxdF48ctGTndslU VNLuaxpdr6VI7SrnFUcKb/2OOi+t4utcDWZJhAw= X-Google-Smtp-Source: AH8x224csJ1LqfwWZLr3H4dcBFjfC6pyr0uS2EXfE+9/jfO5uyzKQ8y8xht6DLJn0dRGwasBpBVepPzFs0lDUAVOj5c= X-Received: by 10.36.0.130 with SMTP id 124mr614876ita.91.1519139709680; Tue, 20 Feb 2018 07:15:09 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.50.83 with HTTP; Tue, 20 Feb 2018 07:15:08 -0800 (PST) In-Reply-To: <50F32C36-4EE5-4375-BAC6-46FCCECE1571@redhat.com> References: <50F32C36-4EE5-4375-BAC6-46FCCECE1571@redhat.com> From: Jonathan Wakely Date: Tue, 20 Feb 2018 15:15:00 -0000 Message-ID: Subject: Re: sign-compare warning for short and char To: Christophe de Dinechin Cc: "gcc@gcc.gnu.org" Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2018-02/txt/msg00155.txt.bz2 This question belongs on the gcc-help list really. On 20 February 2018 at 14:44, Christophe de Dinechin wrote: > I wonder why -Wsign-compare only warns when there is no int promotion? I suspect the correct-but-not-helpful answer is that after integer promotion the operands have the same type, and so there's no comparison between signed and unsigned types. But the compiler could make the warning apply *before* doing integer promotion, to diagnose this case.