From: Jakub Jelinek Date: Wed, 4 Jan 2017 21:34:27 +0000 (+0100) Subject: re PR c++/78949 (incorrect "unused variable" warning with SSE2) X-Git-Tag: basepoints/gcc-8~2024 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=abec4284a64b3ebc6f986b5223a3623e682ae348;p=thirdparty%2Fgcc.git 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 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 833b9049ee44..8dc6588ec31c 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2017-01-04 Jakub Jelinek + 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. diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 57a69efb81e7..6da98f65bdd3 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -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: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index abdb8bb5a7ea..f56c11b957f9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2017-01-04 Jakub Jelinek + PR c++/78949 + * c-c++-common/Wunused-var-16.c: New test. + PR c++/78693 * g++.dg/cpp0x/pr78693.C: New test. diff --git a/gcc/testsuite/c-c++-common/Wunused-var-16.c b/gcc/testsuite/c-c++-common/Wunused-var-16.c new file mode 100644 index 000000000000..98e66a723809 --- /dev/null +++ b/gcc/testsuite/c-c++-common/Wunused-var-16.c @@ -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; +}