This is the mail archive of the
mailing list for the GCC project.
Re: Issues with testsuite on constant pointer arithmetics
Stelian Pop <firstname.lastname@example.org> writes:
> I did spent a few hours looking but haven't had much luck.
> I tried tracing this one:
>> > 6 long i = s.f-&s.b;
> and noticed that the pointers gets casted to 'long' (so they become integers
> and no longer pointers) before the actual substraction is made.
> Of course, replacing the 'long' with 'int' (on the incriminated targets,
> where the real size of the pointer is 16 bit, the size of an 'int') makes
> the code compile as a charm.
I took a quick look at a similar case for x86, and the key step seems to
be a call to ptr_difference_const. It converts the difference of two
ADDR_EXPRs to a constant.