This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH RFA: PR 29286: Handle placement new aliasing issues
Eric Botcazou <ebotcazou@adacore.com> writes:
> > But I believe I am still correct in saying that TYPE_REF_CAN_ALIAS_ALL
> > disables the whole analysis. It replaces it with a much simpler
> > analysis: a TYPE_REF_CAN_ALIAS_ALL cast is like a function call, and a
> > TYPE_REF_CAN_ALIAS_ALL pointer P can point to any call clobbered
> > variable V. Presumably setting a TYPE_REF_CAN_ALIAS_ALL pointer to
> > the address of a variable counts as a cast and thus counts as call
> > clobbering the variable. This effectively disables all steps of the
> > alias analysis code with respect to TYPE_REF_CAN_ALIAS_ALL pointers,
> > and also disables much of the alias analysis applied to variables
> > whose address is taken by TYPE_REF_CAN_ALIAS_ALL pointers.
>
> I agree with everything, except "whole and "all". My understanding is that
> points-to analysis is not disabled for TYPE_REF_CAN_ALIAS_ALL pointers, i.e.
> if the solver can prove that a TYPE_REF_CAN_ALIAS_ALL pointer points to a
> specific set of variables, then dereferencing it is not deemed conflicting
> with assignments to variables not in the set. In this sense, the whole alias
> analysis is not disabled for TYPE_REF_CAN_ALIAS_ALL pointers.
For every dereferenced pointer, we call get_smt_for. For REF_ALL
pointers, this always returns ref_all_symbol_mem_tag. In
finalize_ref_all_pointers, we make every call clobbered variable an
alias for ref_all_symbol_mem_tag. The effect is to say that any
reference through a REF_ALL pointer can change any call clobbered
variable.
Still, you're right, I missed a subtlety. If there is a set of
variables which are not call clobbered, and whose address is never
cast to a TYPE_REF_CAN_ALIAS_ALL type, then I think that REF_ALL
pointers will never be considered as pointing to them.
Ian