Re: user-mode port 0.44-2.4.7

Chris Friesen (cfriesen@nortelnetworks.com)
Wed, 25 Jul 2001 19:37:20 -0400


Linus Torvalds wrote:
>
> On Thu, 26 Jul 2001, Andrea Arcangeli wrote:
> >
> > I will if Honza assures me that no future version of gcc will cause me to
> > crash if I don't declare xtime volatile and I play with it while it can
> > change under me (which seems not the case from his last email).
>
> WHY DO YOU NOT ADD THE "VOLATILE" TO THE PLACES THAT _CARE_?
>
> This is not a gcc issue. Even if gcc _were_ to generate bad code, the
> global volatile _still_ wouldn't be the correct answer.

I think his worry is the pedantic reason that without the volatile gcc is
allowed to write code that chokes and dies if xtime happens to change in a
volatile manner. The example given earlier was:

code as written:
kprintf("%d\n",xtime.tv_usec);

code as compiled by gcc (with xtime not specified as volatile):
suseconds_t temp = xtime.tv_usec;
if (temp != xtime.tv_usec)
BUG();
kprintf"%d\n",temp);

I hope that gcc would not do such a thing, but I think a case could be made that
it could do it and still comply with the language standard.

Of course, since the linux kernel is an important thing for gcc to compile, I
can't imagine them doing something that would break it on purpose without a
really good reason.

Chris

-- 
Chris Friesen                    | MailStop: 043/33/F10  
Nortel Networks                  | work: (613) 765-0557
3500 Carling Avenue              | fax:  (613) 765-2986
Nepean, ON K2H 8E9 Canada        | email: cfriesen@nortelnetworks.com
-
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/