[PATCH] Fix PR tree-opt/21304, by reducing referenced variables
Daniel Berlin
dberlin@dberlin.org
Thu Oct 13 03:20:00 GMT 2005
On Wed, 2005-10-12 at 23:08 -0400, Andrew Pinski wrote:
> The problem here is that for the following code:
> int t;
> int *p = &t;
> void g(int**);
> int f(void)
> {
> *p = 1;
> g(&p);
> return *p;
> }
>
> We cause t to be in the referenced variables even though we don't know
> where
> p could point to. In fact in g, we could change where p points to.
> This is only a very reduced testcase, in the full testcase p is a much
> bigger array referencing a lot of variables and there are a lot of small
> functions. If p was not initialized or was an external variable, we
> would have this problem. The only two cases where we have to look at
> a variable's initializer is when the variable has TREE_READONLY or
> TREE_CONSTANT set.
I should warn you i will probably end up changing this test for 4.2 to
be TREE_STATIC || TREE_READONLY || TREE_CONSTANT
because in IPA mode, in 4.2, we will be able to tell you where statics
point to (assuming they don't escape).
Whether we do that now or then, i have no care :)
More information about the Gcc-patches
mailing list