This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Issues with testsuite on constant pointer arithmetics


Stelian Pop <stelian@popies.net> 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.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]