Re: user-mode port 0.44-2.4.7

From: Andrea Arcangeli (
Date: Mon Jul 23 2001 - 17:09:33 EST

On Mon, Jul 23, 2001 at 03:50:54PM -0600, Richard Gooch wrote:
> Andrea Arcangeli writes:
> > cases if the code breaks in the actual usages of xtime it is likely that
> > gcc is doing something stupid in terms of performance. but GCC if it
> > wants to is allowed to compile this code:
> >
> > printf("%lx\n", xtime.tv_sec);
> >
> > as:
> >
> > unsigned long sec = xtime.tv_sec;
> > if (sec != xtime.tv_sec)
> > BUG();
> > printf("%lx\n", sec);
> And if it does that, it's stupid. Why on earth would GCC add extra
> code to check if a value hasn't changed? I want it to produce

GCC will obviously _never_ introduce a BUG(), I never said that, the
above example is only meant to show what GCC is _allowed_ to do and what
we have to do to write correct C code.

The real life case of the BUG() is when gcc optimize `case' with a jump
table the equivalent of BUG() will be you derferencing a dangling
pointer at runtime. Same can happen in other cases but don't ask me the
other cases as I'm not a gcc developer and I've no idea what they plans
to do for other things (ask Honza for those details).

> efficient code. What's next? Wrap checking?
> printk ("You've just wrapped an integer: press [ENTER] to confirm,
> [NT] to ignore ");
> Regards,
> Richard....
> Permanent:
> Current:

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

This archive was generated by hypermail 2b29 : Mon Jul 23 2001 - 21:00:17 EST