[Bug tree-optimization/33535] bitpos_of_field() returns false result base of hard coded multiplication by 8
tomerben at ceva-dsp dot com
gcc-bugzilla@gcc.gnu.org
Sun Sep 23 16:32:00 GMT 2007
------- 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
More information about the Gcc-bugs
mailing list