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

Siddhesh Poyarekar
2012-03-05T06:34:43Z

On Thu, Mar 01, 2012 at 11:44:28PM +0100, Jan Kratochvil wrote:
> But to make this patch really working for struct offsets (and not just enum's)
> one needs to also extend the type->length width. I am sorry but it will be
> a big patch.

OK, will work on this.

> splint gives nice advices, thanks for the idea. I think it would not give a
> 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.

> > - ((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?

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

--
Siddhesh