Re: [PATCH] Expand bitpos to LONGEST to allow access to large offsets within a struct

Jan Kratochvil
2012-03-05T08:05:38Z

On Mon, 05 Mar 2012 07:35:43 +0100, Siddhesh Poyarekar wrote:
> On Thu, Mar 01, 2012 at 11:44:28PM +0100, Jan Kratochvil wrote:
> > warning if there is incorrectly used 'long' instead of LONGEST'.
>
> I think it should give this warning on ia32, since there is a storage
> size mismatch there. That said, I need to test on 32-bit the next time
> too.

True, good idea.

> > > - ((TYPE_UNSIGNED (type) ? ax_zero_ext : ax_ext) (ax, end - start));
> > > + ((TYPE_UNSIGNED (type) ? ax_zero_ext : ax_ext) (ax, (int)(end - start)));
> >
> > Here I think ax_zero_ext and ax_ext should use LONGEST instead of the cast.
> > (OK, one may argue a bit about it.)
>
> The reason I cast it down to INT is because the eventual call to
> generic_ext() requires N to be between 0 and 255. But I guess we might
> want to keep the value intact to catch any internal bugs that may
> trigger this?

Yes, I meant that.

> Thanks for your very detailed review. I'll fix up the patch and also
> expand type->length.

Maybe you can keep that patch as a separate one; but I do not mind much.

Thanks,
Jan