This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/51196] FAIL: g++.dg/cpp0x/Wzero-as-null-pointer-constant-1.C
- From: "paolo.carlini at oracle dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 21 Nov 2011 15:53:55 +0000
- Subject: [Bug c++/51196] FAIL: g++.dg/cpp0x/Wzero-as-null-pointer-constant-1.C
- Auto-submitted: auto-generated
- References: <bug-51196-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51196
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC|Greta.Yorsh at arm dot com |
--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-11-21 15:53:55 UTC ---
Unexpectedly ;) I'm making progress debugging this: what happens is that, for
arm, in cp_build_binary_op, case EQ_EXPR (this is for 'if (pmf == 0)') here:
if (TARGET_PTRMEMFUNC_VBIT_LOCATION
== ptrmemfunc_vbit_in_delta)
{
tree pfn0 = pfn_from_ptrmemfunc (op0);
tree delta0 = delta_from_ptrmemfunc (op0);
tree e1 = cp_build_binary_op (location,
EQ_EXPR,
pfn0,
build_zero_cst (TREE_TYPE (pfn0)),
complain);
tree e2 = cp_build_binary_op (location,
BIT_AND_EXPR,
delta0,
integer_one_node,
complain);
e2 = cp_build_binary_op (location,
EQ_EXPR, e2, integer_zero_node,
complain);
op0 = cp_build_binary_op (location,
TRUTH_ANDIF_EXPR, e1, e2,
complain);
op1 = cp_convert (TREE_TYPE (op0), integer_one_node);
}
else
{
op0 = build_ptrmemfunc_access_expr (op0, pfn_identifier);
op1 = cp_convert (TREE_TYPE (op0), op1);
}
the condition is true, thus we don't call cp_convert with op1, which is
integer_zero_node here, instead we pass integer_one_node to cp_convert and the
warning down in cp_convert_to_pointer cannot possibly trigger (actually, for
arm we don't even reach cp_convert_to_pointer)
Thus, an idea for fixing the problem would be just warn right here for arm and
similar targets, because here we know that op1 is indeed integer_zero_node (and
that TYPE_PTRMEMFUNC_P (type0) is true of course)
Jason, can you imagine something neater?