Re: VM-related Oops: 2.4.15pre1

From: Linus Torvalds (torvalds@transmeta.com)
Date: Sun Nov 18 2001 - 21:02:17 EST


On Sun, 18 Nov 2001, Alan Cox wrote:
>
> Why is it a compiler bug. You've not declared that variable to be volatile
> therefore it is only touched in the code flow the compiler is analysing.

Even without volatile, the compiler is very arguably buggy if it writes
values to your variables that were never supposed to be there.

Take this, for example:

        sig_atomic_t value = 1;

        int fn()
        {
                value = 2;
        }

And a signal comes in. Even without the volatile, if gcc has written
_anything_ else than 1 or 2 into the variable, gcc is BROKEN.

There's no point being a language lawyer and saying that gcc "could write
anything to value before it writes the final 2". Tha's not true. A compile
rthat does that is

 (a) buggy as hell from a POSIX standpoint
 (b) even apart from POSIX, from a Q-of-I standpoint complete and utter
     crap.

And yes, the argument for "page->flags" is _exactly_ the same. Writing
intermediate values to "page->flags" that were never referenced by the
programmer is clearly such a violation of QoI that it is a bug even if
"sig_atomic_t" happens to be "int", and "page->flags" happens to be
"unsigned int".

                Linus

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Nov 23 2001 - 21:00:18 EST