This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/33887] [4.1/4.2/4.3 Regression] Reference to bitfield gets wrong value when optimizing
- From: "aoliva at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 14 Jan 2008 19:56:21 -0000
- Subject: [Bug c++/33887] [4.1/4.2/4.3 Regression] Reference to bitfield gets wrong value when optimizing
- References: <bug-33887-1313@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #22 from aoliva at gcc dot gnu dot org 2008-01-14 19:56 -------
Both are cases in which the absence of bit-field reduction *on widening
conversions* causes the problem.
I realize the absence of such reductions can be harmful in other cases as well,
e.g. division and right-shifts. But for most cases, modulo semantics
guarantees the correct results as long as we stick to the narrower type.
However, when modulo semantics is required, reduction must take place, e.g. for
compare operations that don't disregard the bits that are not in the type's
implied mask.
I believe the module semantics is the reasoning behind the no-reduction policy.
But I do see that we fail to implement it properly, and I don't know whether
it is the front-end's responsibility to provide the missing bits explicitly, or
the middle end to cover for what the front end might be assuming the middle
end will provide.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33887