This is the mail archive of the gcc-patches@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: RFC: add constant offset to bit_offset in get_inner_reference


kenner@vlsi1.ultra.nyu.edu (Richard Kenner) writes:
> It's wrong to mix bit and byte offsets like this

But a host_integerp byte offset will be turned into a bit offset
later, at the end of get_inner_reference.

> perhaps you can say more about what you are trying to fix.  Please
> give an example.

First of all, there is no bug to fix.  I'm just trying to make
get_inner_reference more consistent (for some value of "consistent").

Example:

    struct foo { int a; int b[1]; }
    struct foo *x;

When referring to x->b[0], get_inner_reference will return offset ==
NULL, and bit_offset == 32 (on a 32-bit machine).

When referring to x->b[i], get_inner_reference will return offset ==
i + 4, and bit_offset == 0.  I'm trying to make it return offset == i,
and bit_offset == 32.  Is that a mistake?

-- 
Lars Brinkhoff          http://lars.nocrew.org/     Linux, GCC, PDP-10,
Brinkhoff Consulting    http://www.brinkhoff.se/    HTTP programming


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