On Jan 31, 2008 9:26 PM, DJ Delorie <[EMAIL PROTECTED]> wrote: > > > It's correct to always sign-extend the offset to the pointer mode > > width (or simply truncate it, if the offset width is larger than > > pointer mode width). > > I'd argue against that if you're dereferencing a large structure > pointer. P->foo would always be an unsigned offset. Similarly for > arrays, although one could argue either way with that.
You cannot tell the unsigned case apart from the signed case and structure dereferences are using COMPONENT_REF, not POINTER_PLUS_EXPR. The middle-end assumes that the offset part of POINTER_PLUS_EXPR is signed, so to extend it this way during expansion would be the natural thing to do. > In the m32c case, though, the offset is a signed type, but an unsigned > extension was used. The mismatch is the problem. Yes, but sizetype is unsigned (but sign-extended - which is appearantly not enforced at expansion here). > Either way, there's going to be a compromise. I don't think it's a compromise - it's just a bugfix ;) Richard.