From mboxrd@z Thu Jan 1 00:00:00 1970 From: "David S. Miller" To: mark@codesourcery.com Cc: chip@perlsupport.com, egcs@egcs.cygnus.com, torvalds@transmeta.com Subject: Re: Linux and aliasing? Date: Wed, 30 Jun 1999 15:43:00 -0000 Message-ID: <199906031924.MAA00337@pizda.davem.net> References: <19990603131344.W375@perlsupport.com> <19990603104038Z.mitchell@codesourcery.com> <199906031824.LAA26672@pizda.davem.net> <19990603120733J.mitchell@codesourcery.com> X-SW-Source: 1999-06n/msg00092.html Message-ID: <19990630154300.1HK7Mh6ijjP81r3z4TmfkrQL5JShn88-RQ91Sj-8RD4@z> From: mark@codesourcery.com Date: Thu, 03 Jun 1999 12:07:33 -0700 David> I'm not saying this should be the normal mode of operation, David> but some mechanism needs to exist so that such code can be David> made valid _without_ resorting to ugly unions. There is one: -fno-strict-aliasing. And there is another: if my code is not "standard C" then output an error instead of silently generating bad code. Then again, I did not specify -ansi and -ansi is not the default, and therefore I have not asked for "standard C", instead I expect to get "GNU C" which traditionally has been "standard C + common sense" :-) So in that light, there is: If some pointer is cast to another of a different storage class or size, I'm doing something strange, and the compiler should turn off aliasing optimizations for anything to do with that set/class of pointers. I know it can be detected, and I also know aliasing can be turned off for a particular class of related pointers just as easily in the current compiler code. Common sense should override whatever standards say, where feasible, and I argue that here it is indeed feasible. You might consider implementing this, or hiring someone else to do it for you. Before anyone considers implementing any change, it would be prudent to make sure most folks agree on the issue and how it should be solved. Later, David S. Miller davem@redhat.com