This is the mail archive of the 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: [PATCH] Remove bogus optimization from may_alias_p

On Mon, 20 Oct 2008, Diego Novillo wrote:

> 2008/10/19 Richard Guenther <>:
> > This removes a test where one subtest is always false and the
> > other one is always true if unmodifiable_var_p (var) is true,
> > which is obviously bogus.  On the trunk this causes false
> > TBAA pruning of points-to sets.
> This also prunes the case where a regular pointer is made to point to
> a read-only variable.  The user gets a warning about mismatched const
> settings.  So TBAA should be able to prune this.

Well, the basic problem of the way the test is implemented is that it
compares unmodifiable_var_p on a SMT (which is always false) with
unmodifiable_var_p on a decl.  So we have

  if ((unmodifiable_var_p (mem) && !unmodifiable_var_p (var))
      || (unmodifiable_var_p (var) && !unmodifiable_var_p (mem)))

that is equivalent to

  if (false
      || (unmodifiable_var_p (var) && true))

which makes us always prune readonly variables from points-to sets.
Even if the pointer (which is represented as SMT here) is "readonly"
(though, as you might know, the GCC middle-end doesn't know a thing
like a pointer that points to readonly memory - at least the const
qualifier cannot be reliably used for this)

> You also need a test case.

I can add one scanning the alias dump for the resulting points-to set.
Or just wait for my fix of PR36509 which will cause bootstrap failures
due to bogus alias warnings if the PTA set pruning is not fixed.


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