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: m32c: pointer math vs sizetype again


> NEGATE_EXPR on an unsigned type is fully defined.  It's what you
> should get when you say "unsigned int i, j; ...; i = - j;".

I didn't say it was undefined, I said it seemed wrong.  Esp since the
example starts with a plain "int" value.

> I think the problem you are facing may be that POINTER_PLUS_EXPR
> generally assumes that the right type to use to add to a pointer is
> sizetype.  You may need to make it use a different type, though I'm
> not sure what that type should be in your case.

ptrdiff_type ?  That is the "difference between pointers" type, which
seems like *exactly* what you should use for adding/subtracting
integer values to/from pointers.


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