This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFC: add constant offset to bit_offset in get_inner_reference
- From: Lars Brinkhoff <lars dot spam at nocrew dot org>
- To: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- Cc: gcc-patches at gcc dot gnu dot org
- Date: 14 Feb 2002 16:18:32 +0100
- Subject: Re: RFC: add constant offset to bit_offset in get_inner_reference
- Organization: nocrew
- References: <10202141422.AA19226@vlsi1.ultra.nyu.edu>
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