From: Denis Vlasenko <vda.linux@googlemail.com>
To: Neil Brown <neilb@suse.de>
Cc: Andi Kleen <ak@suse.de>, Sean Reifschneider <jafo@tummy.com>,
linux-kernel@vger.kernel.org
Subject: Re: PATCH - x86-64 signed-compare bug, was Re: select() setting ERESTARTNOHAND (514).
Date: Thu, 11 Jan 2007 20:38:03 +0100 [thread overview]
Message-ID: <200701112038.03722.vda.linux@googlemail.com> (raw)
In-Reply-To: <17829.36029.240912.274302@notabene.brown>
On Thursday 11 January 2007 02:02, Neil Brown wrote:
> If regs->rax is unsigned long, then I would think the compiler would
> be allowed to convert
>
> switch (regs->rax) {
> case -514 : whatever;
> }
>
> to a no-op, as regs->rax will never have a negative value.
In C, you never actually compare different types. They always
promoted to some common type first.
both sides of (impicit) == here get promoted to "biggest" integer,
in this case, to unsigned long. "-514" is an int, so it gets
sign extended to the width of "long" and then converted to
unsigned long.
--
vda
next prev parent reply other threads:[~2007-01-11 19:39 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-10 23:42 select() setting ERESTARTNOHAND (514) Sean Reifschneider
2007-01-11 0:27 ` David Miller
2007-01-11 1:04 ` Sean Reifschneider
2007-01-11 1:15 ` David Miller
2007-01-11 8:25 ` Sean Reifschneider
2007-01-11 22:22 ` bert hubert
2007-01-24 0:50 ` Sean Reifschneider
2007-01-11 0:37 ` PATCH - x86-64 signed-compare bug, was " Neil Brown
2007-01-11 0:40 ` Andi Kleen
2007-01-11 1:02 ` Neil Brown
2007-01-11 1:37 ` Andi Kleen
2007-01-11 4:09 ` Sean Reifschneider
2007-01-11 19:38 ` Denis Vlasenko [this message]
2007-01-11 0:43 ` David Miller
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=200701112038.03722.vda.linux@googlemail.com \
--to=vda.linux@googlemail.com \
--cc=ak@suse.de \
--cc=jafo@tummy.com \
--cc=linux-kernel@vger.kernel.org \
--cc=neilb@suse.de \
/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