public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Christophe de Dinechin <dinechin@redhat.com>
To: Jonathan Wakely <jwakely.gcc@gmail.com>
Cc: "gcc@gcc.gnu.org" <gcc@gcc.gnu.org>
Subject: Re: sign-compare warning for short and char
Date: Tue, 20 Feb 2018 15:43:00 -0000	[thread overview]
Message-ID: <1FE711F4-D99F-47DB-8434-DFB7C96D82E8@redhat.com> (raw)
In-Reply-To: <CAH6eHdQWbWdSehzcBRB8SLht7kUv0AAF5daO2n5ByVYVwmB1Eg@mail.gmail.com>



> On 20 Feb 2018, at 16:15, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
> 
> This question belongs on the gcc-help list really.

I posted here because I saw it as a possible diagnostic bug / limitation. Do such things go to gcc-help? Or is it that you thought I was asking for the correct option?

> On 20 February 2018 at 14:44, Christophe de Dinechin
> <dinechin@redhat.com> 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.

That’s an implementation explanation, not a rationale, right?

> But the compiler could make the warning apply *before* doing integer
> promotion, to diagnose this case.

That is what I am thinking, but I was wondering if there was not some rationale making this a bad idea.

  reply	other threads:[~2018-02-20 15:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-20 14:44 Christophe de Dinechin
2018-02-20 15:15 ` Jonathan Wakely
2018-02-20 15:43   ` Christophe de Dinechin [this message]
2018-02-20 19:49     ` Jonathan Wakely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1FE711F4-D99F-47DB-8434-DFB7C96D82E8@redhat.com \
    --to=dinechin@redhat.com \
    --cc=gcc@gcc.gnu.org \
    --cc=jwakely.gcc@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).