http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45878
--- Comment #6 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-10-13
13:54:54 UTC ---
(In reply to comment #5)
> I think the patch that broke this should be backed out until the semantics are
> sorted out. I think the middle-end people should decide on which part of the
> compiler is wrong, how to make the other-side conform and then change the
> documentation to make it clear. Once that is done, the side that is wrong
> should be fixed, once that is done, the patch can then be reenabled.
>
> So far, it sounds like a ME problem to me.
It is likely a miscommunication (or lack of definition) on what the middle-end
expects from an OBJ_TYPE_REF and what the ObjC frontend uses it for or how
it does that.
The CCP folding piece looks overly simple to me, it should use the
fold-stmt machinery:
Index: tree-ssa-ccp.c
===================================================================
--- tree-ssa-ccp.c (revision 165419)
+++ tree-ssa-ccp.c (working copy)
@@ -2267,6 +2284,7 @@ ccp_fold_stmt (gimple_stmt_iterator *gsi
tree lhs = gimple_call_lhs (stmt);
tree val;
tree argt;
+ tree callee;
bool changed = false;
unsigned i;
@@ -2306,16 +2324,24 @@ ccp_fold_stmt (gimple_stmt_iterator *gsi
changed = true;
}
}
- if (TREE_CODE (gimple_call_fn (stmt)) == OBJ_TYPE_REF)
+
+ callee = gimple_call_fn (stmt);
+ if (TREE_CODE (callee) == OBJ_TYPE_REF
+ && TREE_CODE (OBJ_TYPE_REF_EXPR (callee)) == SSA_NAME)
{
- tree expr = OBJ_TYPE_REF_EXPR (gimple_call_fn (stmt));
- expr = valueize_op (expr);
- if (TREE_CODE (expr) == ADDR_EXPR
- && TREE_CODE (TREE_OPERAND (expr, 0)) == FUNCTION_DECL)
- {
- gimple_call_set_fn (stmt, expr);
- changed = true;
- }
+ tree expr = OBJ_TYPE_REF_EXPR (callee);
+ OBJ_TYPE_REF_EXPR (callee) = valueize_op (expr);
+ if (TREE_CODE (OBJ_TYPE_REF_EXPR (callee)) == ADDR_EXPR)
+ {
+ tree t;
+ t = gimple_fold_obj_type_ref (callee, NULL_TREE);
+ if (t)
+ {
+ gimple_call_set_fn (stmt, t);
+ changed = true;
+ }
+ }
+ OBJ_TYPE_REF_EXPR (callee) = expr;
}
return changed;
but as my ObjC/ObjC++ results on Linux are clean I can't see any issue
with testing. Hmm?