This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

Re: [improved-aliasing]: Better clobbering and clobber stats


On Thu, Sep 29, 2005 at 01:02:19PM -0400, Daniel Berlin wrote:
> This improves our local clobbering by teaching it that things that
> escape through calls can't escape through calls that don't have writable
> pointer arguments.

What do you mean by this?  Don't have "written pointer arguments"
because you're doing IPA and have looked at the implementation to
see that it is true?  Using the non-user accessible "no vops" 
attribute?  Looking at "const" on the pointer argument?

It looks to me that you're doing the last.  Which is incorrect.
It's valid C to cast away const.  It's only invalid to reference
the object through the non-const pointer if the original object
is const qualified.  Thus

	void f(const int *x) { *(int *)x = 0; }
	void g() { int x = 1; f(&x); }

is a valid program, while 

	void g() { const int x = 1; f(&x); }

is not.


r~


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