summaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/c-c++-common')
-rw-r--r--gcc/testsuite/c-c++-common/pr63764-1.c21
-rw-r--r--gcc/testsuite/c-c++-common/pr63764-2.c35
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;
+}