This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Repair TYPE_REF_CAN_ALIAS_ALL machinery
> I don't like the tree-ssa-operands.c part of the patch as we should
> have a mechanism that deals with this problem already, as we have char*
> pointers.
Unless I'm mistaken, we don't special-case 'char*' pointers, we special-case
the type 'char'. However the tree-ssa-operands.c part might indeed be
replaced by a test in may_alias_p that would cause the function to return
true for a ref-all pointer and a call-clobbered variable.
> Btw. I couldn't construct a C testcase that failed.
#include <stdlib.h>
void foo(void)
{
float *pf;
int *pi;
pf = malloc (sizeof(float));
pi = (int *)pf;
*pf = 1.0;
*pi = 0;
if (*pf != 0.0)
abort ();
}
int main(void)
{
foo ();
return 0;
}
Compile at -O2 and -O2 -fno-strict-aliasing on x86.
> So, as you noticed I confused the type
> somewhat so one would
> need to amend the get_alias_set calls in tree-ssa-alias.c:get_tmt_for
> and friends to
> check for TYPE_REF_CAN_ALIAS_ALL on the pointer type and use alias set 0 in
> this case.
Thanks, interesting suggestion, I'm going to give it a whirl too.
--
Eric Botcazou