This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: why are these alias sets different?
>>>>> "Zack" == Zack Weinberg <zack@bitmover.com> writes:
>> And `char *' and `unsigned char *' are not compatible types,
>> which is why they don't have the same alias set. You can't
>> say:
>>
>> unsigned char c; char *p; unsigned char **pp = (unsigned char
>> **) &p; *pp = &c;
Zack> Thanks. I guess I should strip off exactly one layer of
Zack> POINTER_TYPE nodes and then do the comparison, special
Zack> casing void * and char *.
Sounds rightish. I don't know exactly where you're putting the
warning. If you do it the way RMS was suggesting, in alias.c, then
you shouldn't have to strip anything at all. Just call
different_alias_sets or whatever, but after the base alias check has
been done, and warn if it says the alias sets are different but the
base alias check says the memory is the same. If you're doing it
closer to the source, where you're likely to get more coherent warning
messages, then you probably need to strip one level of pointer; when
you see a store through `int **', and want to know if that aliases a
thing of type `double *', you compare `int *' and `double *'.
Zack> Am I right to think that alias sets have nothing to do with
Zack> the base-pointer alias code?
Yes.
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com