Re: arithmetic HI+PSI

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Aurelien Buhrig <aurelien.buhrig.gcc@xxxxxxxxx> writes:

> When I add a pointer (PSImode) with an int (HImode) (ex: sp-=cnt) ,
> gcc expands the signed int by zero_extend'ing  the int and then adding
> both PSI values (instead of sign extending).
> How should I fix this ?
> POINTERS_EXTEND_UNSIGNED is 0.
>
> And what is the difference between ptr_mode and Pmode ?

ptr_mode is the integer mode that corresponds to POINTER_SIZE.
POINTER_SIZE is the size of a pointer as stored in a register or in
memory.  Pmode is the mode to use for a pointer.  Pmode may be larger
than ptr_mode on unusual machines.

As far as I know the int will be converted to SIZE_TYPE before being
added to the pointer.  Converting a signed int to SIZE_TYPE should sign
extend if SIZE_TYPE is larger than int.  I don't know why you are not
seeing that.

Ian


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux