[Bug c++/33887] [4.1/4.2/4.3 Regression] Reference to bitfield gets wrong value when optimizing
rguenth at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Mon Jan 14 16:55:00 GMT 2008
------- Comment #19 from rguenth at gcc dot gnu dot org 2008-01-14 15:45 -------
The bug here is that the FE does not perform integer promotion for ++sv.f2,
but emits
<<cleanup_point <<< Unknown tree: expr_stmt
(void) ++sv.f2 >>>
>>;
which is gimplified to operations on a bitfield type:
<unnamed-unsigned:24> D.2043;
<unnamed-unsigned:24> D.2044;
D.2043 = sv.f2;
D.2044 = D.2043 + 1;
sv.f2 = D.2044;
Once the optimizer realizes it doesn't need to go through memory for sv.f2,
things go downhill, as expand now reaches D.2043 + 1 without the implicit
truncation done at the store to memory.
See my bitfield rant on gcc@ - it's all broke.
The proper C++ FE fix is to perform arithmetic in a promoted type here.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |rguenth at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
Last reconfirmed|2007-12-08 20:07:32 |2008-01-14 15:45:40
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33887
More information about the Gcc-bugs
mailing list