Daniel Berlin - Re: [improved-aliasing]: Better clobbering and clobber stats (original) (raw)

This is the mail archive of the gcc-patches@gcc.gnu.orgmailing 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]

On Thu, 2005-09-29 at 14:40 -0700, Richard Henderson wrote:

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?

It really doesn't matter, in part because it buys us so little compared to just not counting any functions with pointer arguments at all.

Don't have "written pointer arguments" because you're doing IPA and have looked at the implementation to see that it is true?

The functions that matter for this, we can't prove anything about (fputs is an example).

Using the non-user accessible "no vops" attribute?

Looking at "const" on the pointer argument?

The last.

Which is probably not valid in C, but is in some languages where strong typing means something. :)

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.

I've simply disabled that part of the patch.


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