[Bug tree-optimization/33535] bitpos_of_field() returns false result base of hard coded multiplication by 8

2021-07-29 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=33535

Andrew Pinski  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |FIXED
   Target Milestone|--- |4.6.0

--- Comment #3 from Andrew Pinski  ---
Has been fixed since r0-106604.

[Bug tree-optimization/33535] bitpos_of_field() returns false result base of hard coded multiplication by 8

2007-09-23 Thread tomerben at ceva-dsp dot com


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



[Bug tree-optimization/33535] bitpos_of_field() returns false result base of hard coded multiplication by 8

2007-09-23 Thread rguenth at gcc dot gnu dot org


--- Comment #1 from rguenth at gcc dot gnu dot org  2007-09-23 11:04 ---
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)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33535