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:
> > TYPE_REF_CAN_ALIAS_ALL disables the whole analysis. That is, if P has
> > a type with TYPE_REF_CAN_ALIAS_ALL, then the alias analysis code
> > assumes that P could point to V, even if it can't see any way that the
> > address of V could have wound up in the variable P.
>
> I don't think that's true. TYPE_REF_CAN_ALIAS_ALL only disables the last step
> too, albeit in a more heavyweight way.
Sorry, you're right, it only assumes that P could point to V if V is
call clobbered. And it assumes that a cast to or from a
TYPE_REF_CAN_ALIAS_ALL pointer is an escape site, which has the effect
of call clobbering any variable to which any ALIAS_ALL pointer could
point.
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. Or so it
seems to me.
> > I hope you have some test cases for it.
>
> Yes, for example this one which now appears in the logs on mainline:
> FAIL: gnat.dg/address_conversion.adb execution test
Alas, I don't understand what that test case is doing.
Ian