diff options
author | Tom de Vries <tom@codesourcery.com> | 2013-11-27 10:00:48 +0000 |
---|---|---|
committer | Tom de Vries <vries@gcc.gnu.org> | 2013-11-27 10:00:48 +0000 |
commit | 241b71bb88e4b3e77114cee97d2eb611790cb9fa (patch) | |
tree | 59afda12c182fc1e142f96b4e40f4b06d86d1a7a /gcc/c | |
parent | e934916c8647d1e343eaacf114fdbff22dfa07a4 (diff) | |
download | gcc-241b71bb88e4b3e77114cee97d2eb611790cb9fa.zip gcc-241b71bb88e4b3e77114cee97d2eb611790cb9fa.tar.gz gcc-241b71bb88e4b3e77114cee97d2eb611790cb9fa.tar.bz2 |
Handle vector increment/decrement in build_unary_op
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.
* typeck.c (cp_build_unary_op): Allow vector increment and decrement.
* c-c++-common/pr59032.c: New testcase.
Co-Authored-By: Marc Glisse <marc.glisse@inria.fr>
From-SVN: r205439
Diffstat (limited to 'gcc/c')
-rw-r--r-- | gcc/c/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/c/c-typeck.c | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 333aa11..1b7af32 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-11-22 Andrew MacLeod <amacleod@redhat.com> * c-typeck.c: Add required include files from gimple.h. diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index 0c9c8c8..f602ca4 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -3982,7 +3982,7 @@ build_unary_op (location_t location, if (typecode != POINTER_TYPE && typecode != FIXED_POINT_TYPE && typecode != INTEGER_TYPE && typecode != REAL_TYPE - && typecode != COMPLEX_TYPE) + && typecode != COMPLEX_TYPE && typecode != VECTOR_TYPE) { if (code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR) error_at (location, "wrong type argument to increment"); @@ -4047,7 +4047,9 @@ build_unary_op (location_t location, } else { - inc = integer_one_node; + inc = VECTOR_TYPE_P (argtype) + ? build_one_cst (argtype) + : integer_one_node; inc = convert (argtype, inc); } |