diff options
author | Jakub Jelinek <jakub@redhat.com> | 2017-01-04 22:34:27 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2017-01-04 22:34:27 +0100 |
commit | abec4284a64b3ebc6f986b5223a3623e682ae348 (patch) | |
tree | d7e9269f7cc523d6be409caa2e132088684cd804 /gcc | |
parent | 26c43e27441b88b20a463686ffe0b9b5ebbfbcf0 (diff) | |
download | gcc-abec4284a64b3ebc6f986b5223a3623e682ae348.zip gcc-abec4284a64b3ebc6f986b5223a3623e682ae348.tar.gz gcc-abec4284a64b3ebc6f986b5223a3623e682ae348.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/Wunused-var-16.c | 15 |
4 files changed, 24 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 833b904..8dc6588e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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. diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 57a69ef..6da98f6 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 abdb8bb..f56c11b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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. 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 0000000..98e66a7 --- /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; +} |