From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sean Quinlan Subject: Re: [9fans] plan or side effect To: 9fans@cse.psu.edu Message-id: <3C7CFAFE.4996DA2A@research.bell-labs.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT References: Date: Wed, 27 Feb 2002 10:27:58 -0500 Topicbox-Message-UUID: 59338fac-eaca-11e9-9e20-41e7f4b1d025 My experience is that most, if not all, optimizing C compilers will make optimistic assumptions about aliasing. Given that C allows arbitrary cast and application of the & operator, it is pretty much impossible to excatly determine what can be aliased. The compiler takes a shot at figuring this out, but in general, it has to be optimistic if it is going to find many variables that can be registerised. For example, I believe the plan 9 compilers is a little optimistic with globals. The compiler will registerise such variables within a function even though it is possible that the variable is aliased via a pointer. I recall Ken saying he never gets caught, but obviously it is not hard to contrive examples when he will get the "wrong" answer. presotto@plan9.bell-labs.com wrote: > > Bushnell et al, > > By the way, I'm not ignoring Thomas' question. > I'm querying compiler designers I know about my > statement that they know that they might be breaking > programs, i.e. generating incorrect code, > with some optimizations and find that acceptable. > It was definitely a true statement when I was at > DG in the compiler group, but that was a long > time ago. It could be that I'm assuming a plan when > all I'm seeing is the inevitable bugs.