diff options
-rw-r--r-- | gcc/c/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/c/c-typeck.c | 7 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/pr59032.c | 30 |
6 files changed, 56 insertions, 3 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index e9449eee6b9..f3696c21e45 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,9 @@ +2013-11-27 Tom de Vries <tom@codesourcery.com> + Marc Glisse <marc.glisse@inria.fr> + + PR c++/59032 + * c-typeck.c (build_unary_op): Allow vector increment and decrement. + 2013-10-16 Release Manager * GCC 4.8.2 released. diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index ddb6d39774f..428fba92da0 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -3629,7 +3629,8 @@ build_unary_op (location_t location, /* Report invalid types. */ if (typecode != POINTER_TYPE && typecode != FIXED_POINT_TYPE - && typecode != INTEGER_TYPE && typecode != REAL_TYPE) + && typecode != INTEGER_TYPE && typecode != REAL_TYPE + && typecode != VECTOR_TYPE) { if (code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR) error_at (location, "wrong type argument to increment"); @@ -3694,7 +3695,9 @@ build_unary_op (location_t location, } else { - inc = integer_one_node; + inc = (TREE_CODE (argtype) == VECTOR_TYPE + ? build_one_cst (argtype) + : integer_one_node); inc = convert (argtype, inc); } diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index aef43f65b90..4f751d2b44a 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,6 +1,12 @@ 2013-11-27 Tom de Vries <tom@codesourcery.com> Marc Glisse <marc.glisse@inria.fr> + PR c++/59032 + * typeck.c (cp_build_unary_op): Allow vector increment and decrement. + +2013-11-27 Tom de Vries <tom@codesourcery.com> + Marc Glisse <marc.glisse@inria.fr> + PR middle-end/59037 * semantics.c (cxx_fold_indirect_ref): Don't create out-of-bounds BIT_FIELD_REF. diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index d31c573e2c7..cec6c452ade 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -5588,7 +5588,9 @@ cp_build_unary_op (enum tree_code code, tree xarg, int noconvert, inc = cxx_sizeof_nowarn (TREE_TYPE (argtype)); } else - inc = integer_one_node; + inc = (TREE_CODE (argtype) == VECTOR_TYPE + ? build_one_cst (argtype) + : integer_one_node); inc = cp_convert (argtype, inc, complain); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 82dca558b55..b1b1514371b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,12 @@ 2013-11-27 Tom de Vries <tom@codesourcery.com> Marc Glisse <marc.glisse@inria.fr> + PR c++/59032 + * c-c++-common/pr59032.c: New testcase. + +2013-11-27 Tom de Vries <tom@codesourcery.com> + Marc Glisse <marc.glisse@inria.fr> + PR middle-end/59037 * c-c++-common/pr59037.c: New testcase. diff --git a/gcc/testsuite/c-c++-common/pr59032.c b/gcc/testsuite/c-c++-common/pr59032.c new file mode 100644 index 00000000000..327f5aeb6bc --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr59032.c @@ -0,0 +1,30 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +void +foo() +{ + float v __attribute__((vector_size(8))); + v++; +} + +void +foo2 () +{ + float v __attribute__((vector_size(8))); + ++v; +} + +void +foo3 () +{ + float v __attribute__((vector_size(8))); + v--; +} + +void +foo4 () +{ + float v __attribute__((vector_size(8))); + --v; +} |