diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-11-21 09:25:51 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-11-21 09:25:51 +0000 |
commit | c61ef207a590195b3cab42241774788d22a21dbb (patch) | |
tree | c648ac0560be23d2a39d095a04c8de340e96f4bc /gcc/testsuite/c-c++-common | |
parent | e984aff20963b025d6446b0536ee50955322df51 (diff) | |
download | gcc-c61ef207a590195b3cab42241774788d22a21dbb.tar.gz |
PR target/63764
c-family/
* c-common.h (convert_vector_to_pointer_for_subscript): Change
return type to bool.
* c-common.c: Include gimple-expr.c.
(convert_vector_to_pointer_for_subscript): Change return type to
bool. If *vecp is not lvalue_p and has VECTOR_TYPE, return true
and copy it into a TARGET_EXPR and use that instead of *vecp
directly.
c/
* c-typeck.c (build_array_ref): Adjust
convert_vector_to_pointer_for_subscript caller. If it returns true,
call non_lvalue_loc on the result.
cp/
* typeck.c (cp_build_array_ref): Adjust
convert_vector_to_pointer_for_subscript caller. If it returns true,
call non_lvalue_loc on the result.
testsuite/
* c-c++-common/pr63764-1.c: New test.
* c-c++-common/pr63764-2.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@217909 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/c-c++-common')
-rw-r--r-- | gcc/testsuite/c-c++-common/pr63764-1.c | 21 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/pr63764-2.c | 35 |
2 files changed, 56 insertions, 0 deletions
diff --git a/gcc/testsuite/c-c++-common/pr63764-1.c b/gcc/testsuite/c-c++-common/pr63764-1.c new file mode 100644 index 00000000000..a858747c7d8 --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr63764-1.c @@ -0,0 +1,21 @@ +/* PR target/63764 */ +/* { dg-do compile } */ + +#define A __attribute__((vector_size (4 * sizeof (float)))) +typedef float V A; + +void +fn1 (V *x) +{ + V a = *x; + ((V) a)[0] = 0; /* { dg-error "lvalue required as left operand of assignment" } */ + *x = a; +} + +void +fn2 (V *x) +{ + float A a = *x; + ((float A) a)[0] = 0; /* { dg-error "lvalue required as left operand of assignment" } */ + *x = a; +} diff --git a/gcc/testsuite/c-c++-common/pr63764-2.c b/gcc/testsuite/c-c++-common/pr63764-2.c new file mode 100644 index 00000000000..6bbf6611e6c --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr63764-2.c @@ -0,0 +1,35 @@ +/* PR target/63764 */ +/* { dg-do compile } */ + +#define A __attribute__((vector_size (4 * sizeof (float)))) +typedef float V A; + +float +fn1 (V *x) +{ + V a = *x; + return ((V) a)[0]; +} + +float +fn2 (V *x) +{ + float A a = *x; + return ((float A) a)[0]; +} + +void +fn3 (V *x) +{ + V a = *x; + a[0] = 0; + *x = a; +} + +void +fn4 (V *x) +{ + float A a = *x; + a[0] = 0; + *x = a; +} |