This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Linux and aliasing?




On Mon, 7 Jun 1999, Tim Hollebeek wrote:
> 
> This is going to happen even with the Torvalds hack.  If they are
> writing code that ignores the aliasing rules, not every single
> instance will conform to the Torvalds "all pointer trickery happens in
> a single expression" coding style.  Hence their binary will still fail.

Yes. But it's less likely to fail.

However, somebody else did suggest just a warning (for the "torvalds case"
and potentially for other cases that are deemed suspect), and I certainly
agree with that as a kind of "uhhuh, somebody is doing something
dangerous". 

However, even then I think we'd _also_ need to have a syntactically
cleaner way of fixing it - if a warning is generated it obviously would
need to have some way of disabling the warning on a case-by-case basis
(with either saying "it's ok to alias - don't warn me" or a "oh, you were
right, this could alias, please consider it to be in alias set zero").

I completely agree with that kind of extension - it's obviously better
than mine, but it's also much more ambitious than my quick and simple
hack.

> Then we'll have to explain two things to them instead of just one: the
> ANSI rules, and the extra Torvalds non-ANSI rules. 

Just explain it as "dangerous code", and give examples. There are
certainly bound to be other cases, although the "torvalds case" is the
obvious and most common one. 

		Linus


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]