This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/33535] bitpos_of_field() returns false result base of hard coded multiplication by 8
- From: "tomerben at ceva-dsp dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 23 Sep 2007 16:31:56 -0000
- Subject: [Bug tree-optimization/33535] bitpos_of_field() returns false result base of hard coded multiplication by 8
- References: <bug-33535-15138@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from tomerben at ceva-dsp dot com 2007-09-23 16:31 -------
(In reply to comment #1)
> If so (did you look how DECL_FIELD_OFFSET is set?) then the documentation in
> tree.h needs adjustment as well:
> /* In a FIELD_DECL, this is the field position, counting in bytes, of the
> DECL_OFFSET_ALIGN-bit-sized word containing the bit closest to the beginning
> of the structure. */
> #define DECL_FIELD_OFFSET(NODE) (FIELD_DECL_CHECK (NODE)->field_decl.offset)
I don't think the documentation needs to be modified - multiplying the offset
in bytes (=units) by the BITS_PER_UNIT makes perfect sense to get the bitpos of
a certain field.
taken from the gcc internals:
"BITS_PER_UNIT [Macro]- Define this macro to be the number of bits in an
addressable storage unit (byte). If you do not define this macro the default is
8."
In most cases unit=byte=8 but in my case unit=byte=16 and hard coded
multiplication by 8 is wrong.
--
tomerben at ceva-dsp dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tomerben at ceva-dsp dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33535