9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "ron minnich" <rminnich@gmail.com>
To: "Fans of the OS Plan 9 from Bell Labs" <9fans@cse.psu.edu>
Subject: Re: [9fans] quiz
Date: Tue,  5 Jun 2007 20:41:54 -0700	[thread overview]
Message-ID: <13426df10706052041x516117f0sf873a56ed5c05b94@mail.gmail.com> (raw)
In-Reply-To: <1181090589.4241.41.camel@work.sfbay.sun.com>

On 6/5/07, Roman Shaposhnick <rvs@sun.com> wrote:
> On Tue, 2007-06-05 at 17:36 -0700, ron minnich wrote:
> > /* catch the bug */
> >
> > struct x {
> >   int botch:1;
> > };
> >
> > fun(){
> >   struct x x;
> >   x.botch = 0;
> >   x.botch = 1;
> > }
> >
> > ok, what's the bug? anyone? I just found this out today. (no, I don't
> > use bitfields, but insane people do)
>
>   signed vs. unsigned int perhaps (meaning that x.botch becomes < 0
> after the last assignment) ?


yeah. x.botch is 0 after last assignment. Until recently, gcc would
give you dispensation and set x.botch to -1 anyway if you set x.botch
= 1. But, recently, it now figures out it's an overflow and sets
x.botch to 0. So, lots of code all over the place will now do the
unexpected, in reverse of what it used to do. It's interesting to
watch.

This change evidently broke much code. So folks are chasing down their
assignments all over the place, catching up with the change. Just saw
this going by the Xen list.

Bitfields are another story. People really love 'em in some parts of
this universe.

ron


  reply	other threads:[~2007-06-06  3:41 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-06  0:36 ron minnich
2007-06-06  0:43 ` Roman Shaposhnick
2007-06-06  3:41   ` ron minnich [this message]
2007-06-06  3:48     ` Roman Shaposhnik
2007-06-06  4:18       ` ron minnich
2007-06-06  4:30         ` Kris Maglione
2007-06-06  4:36           ` Kris Maglione
2007-06-06  7:05             ` Bruce Ellis
2007-06-06  8:15             ` W B Hacker
2007-06-06  1:07 ` Paul Lalonde
2007-06-06  1:16   ` Roman Shaposhnick
2007-06-06  8:49 ` [9fans] quiz prem
  -- strict thread matches above, loose matches on Subject: below --
2002-05-02  5:55 [9fans] quiz rob pike, esq.

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=13426df10706052041x516117f0sf873a56ed5c05b94@mail.gmail.com \
    --to=rminnich@gmail.com \
    --cc=9fans@cse.psu.edu \
    /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 NNTP newsgroup(s).