Commit 416f380b by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/44780 (Bogus set-but-not-used variable warning)

	PR c++/44780
	* typeck.c (convert_for_assignment): When converting a convertible
	vector type or objc++ types, call mark_rvalue_use.
	* typeck2.c (build_m_component_ref): Use return values from
	mark_rvalue_use or mark_lvalue_use.
	* class.c (build_base_path): Likewise.
	* call.c (build_conditional_expr): Likewise.

	* c-c++-common/Wunused-var-12.c: New test.

From-SVN: r161742
parent 2dc8bd76
2010-07-02 Jakub Jelinek <jakub@redhat.com>
PR c++/44780
* typeck.c (convert_for_assignment): When converting a convertible
vector type or objc++ types, call mark_rvalue_use.
* typeck2.c (build_m_component_ref): Use return values from
mark_rvalue_use or mark_lvalue_use.
* class.c (build_base_path): Likewise.
* call.c (build_conditional_expr): Likewise.
2010-07-02 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/44039
......
......@@ -3861,8 +3861,8 @@ build_conditional_expr (tree arg1, tree arg2, tree arg3,
&& same_type_p (arg2_type, arg3_type))
{
result_type = arg2_type;
mark_lvalue_use (arg2);
mark_lvalue_use (arg3);
arg2 = mark_lvalue_use (arg2);
arg3 = mark_lvalue_use (arg3);
goto valid_operands;
}
......
......@@ -284,7 +284,7 @@ build_base_path (enum tree_code code,
/* This must happen before the call to save_expr. */
expr = cp_build_unary_op (ADDR_EXPR, expr, 0, tf_warning_or_error);
else
mark_rvalue_use (expr);
expr = mark_rvalue_use (expr);
offset = BINFO_OFFSET (binfo);
fixed_type_p = resolves_to_fixed_type_p (expr, &nonnull);
......
......@@ -7211,7 +7211,10 @@ convert_for_assignment (tree type, tree rhs,
if (TREE_CODE (type) == VECTOR_TYPE && coder == VECTOR_TYPE
&& vector_types_convertible_p (type, rhstype, true))
return convert (type, rhs);
{
rhs = mark_rvalue_use (rhs);
return convert (type, rhs);
}
if (rhs == error_mark_node || rhstype == error_mark_node)
return error_mark_node;
......@@ -7255,7 +7258,10 @@ convert_for_assignment (tree type, tree rhs,
}
if (objc_compare_types (type, rhstype, parmno, rname))
return convert (type, rhs);
{
rhs = mark_rvalue_use (rhs);
return convert (type, rhs);
}
}
/* [expr.ass]
......
......@@ -1478,8 +1478,8 @@ build_m_component_ref (tree datum, tree component)
if (error_operand_p (datum) || error_operand_p (component))
return error_mark_node;
mark_lvalue_use (datum);
mark_rvalue_use (component);
datum = mark_lvalue_use (datum);
component = mark_rvalue_use (component);
ptrmem_type = TREE_TYPE (component);
if (!TYPE_PTR_TO_MEMBER_P (ptrmem_type))
......
2010-07-02 Jakub Jelinek <jakub@redhat.com>
PR c++/44780
* c-c++-common/Wunused-var-12.c: New test.
2010-07-02 Bernd Schmidt <bernds@codesourcery.com>
PR target/42835
......
/* PR c++/44780 */
/* { dg-do compile } */
/* { dg-options "-Wunused" } */
typedef double vec __attribute__ ((__vector_size__ (16)));
vec c, d;
void
foo (void)
{
vec a;
vec b;
a = c;
b = a;
d = b;
}
void
bar (void)
{
vec a;
vec b; /* { dg-warning "set but not used" } */
a = c;
b = a;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment