re PR c++/78949 (incorrect "unused variable" warning with SSE2)

PR c++/78949
	* typeck.c (cp_build_unary_op): Call mark_rvalue_use on arg if it has
	vector type.

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

From-SVN: r244075
This commit is contained in:
Jakub Jelinek 2017-01-04 22:34:27 +01:00 committed by Jakub Jelinek
parent 26c43e2744
commit abec4284a6
4 changed files with 24 additions and 0 deletions

View File

@ -1,5 +1,9 @@
2017-01-04 Jakub Jelinek <jakub@redhat.com>
PR c++/78949
* typeck.c (cp_build_unary_op): Call mark_rvalue_use on arg if it has
vector type.
PR c++/78693
* parser.c (cp_parser_simple_declaration): Only complain about
inconsistent auto deduction if auto_result doesn't use auto.

View File

@ -5907,6 +5907,8 @@ cp_build_unary_op (enum tree_code code, tree xarg, bool noconvert,
inform (location, "did you mean to use logical not (%<!%>)?");
arg = cp_perform_integral_promotions (arg, complain);
}
else if (!noconvert && VECTOR_TYPE_P (TREE_TYPE (arg)))
arg = mark_rvalue_use (arg);
break;
case ABS_EXPR:

View File

@ -1,5 +1,8 @@
2017-01-04 Jakub Jelinek <jakub@redhat.com>
PR c++/78949
* c-c++-common/Wunused-var-16.c: New test.
PR c++/78693
* g++.dg/cpp0x/pr78693.C: New test.

View File

@ -0,0 +1,15 @@
/* PR c++/78949 */
/* { dg-do compile } */
/* { dg-options "-Wunused" } */
typedef unsigned char V __attribute__((vector_size(16)));
V v;
void
foo ()
{
V y = {};
V x = {}; // { dg-bogus "set but not used" }
y &= ~x;
v = y;
}