This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/20607] [3.4 Regression] -fstrict-aliasing causes incorrect scheduling
- From: "mmitchel at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 10 May 2005 02:49:23 -0000
- Subject: [Bug c++/20607] [3.4 Regression] -fstrict-aliasing causes incorrect scheduling
- References: <20050323190354.20607.Ganesh.Sittampalam@arm.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From mmitchel at gcc dot gnu dot org 2005-05-10 02:49 -------
The reason that this happens when the type assigned is a class types is that
those types have overloaded operator=. There's always an implicit operator=,
even if one is not declared explicitly, with a "this" argument of type "T*".
So, we take the address of "conv.first" in preparation for passing it to the
function. Now, in build_unary_op, we do this bit:
tree field = TREE_OPERAND (arg, 1);
tree rval = build_unary_op (ADDR_EXPR, TREE_OPERAND (arg, 0), 0);
tree binfo = lookup_base (TREE_TYPE (TREE_TYPE (rval)),
decl_type_context (field),
ba_check, NULL);
rval = build_base_path (PLUS_EXPR, rval, binfo, 1);
=> rval = build_nop (argtype, rval);
addr = fold (build (PLUS_EXPR, argtype, rval,
cp_convert (argtype, byte_position (field))));
which destroys the COMPONENT_REF.
This is rather silly. In more current compilers, we have actual FIELDs for the
base classes, and we should just be chasing through them. Certainly, when the
class containing the field and the class of the object are the same, there's no
need for any of this.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20607