+2019-10-01 Richard Sandiford <richard.sandiford@arm.com>
+
+ * c-pretty-print.c (pp_c_specifier_qualifier_list): If a vector type
+ has a type name, use it in preference to the __vector syntax.
+
2019-09-30 Richard Sandiford <richard.sandiford@arm.com>
* c-pretty-print.c (pp_c_parameter_type_list): Avoid printing
? "_Complex" : "__complex__"));
else if (code == VECTOR_TYPE)
{
+ /* The syntax we print for vector types isn't real C or C++ syntax,
+ so it's better to print the type name if we have one. */
+ tree name = TYPE_NAME (t);
+ if (!(pp->flags & pp_c_flag_gnu_v3)
+ && name
+ && TREE_CODE (name) == TYPE_DECL)
+ {
+ pp->id_expression (name);
+ break;
+ }
pp_c_ws_string (pp, "__vector");
pp_c_left_paren (pp);
pp_wide_integer (pp, TYPE_VECTOR_SUBPARTS (t));
+2019-10-01 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gcc.dg/diag-aka-3.c: New test.
+ * gcc.target/aarch64/diag_aka_1.c: New test.
+ * g++.dg/diagnostic/aka4.C: New test.
+
2019-10-01 Richard Sandiford <richard.sandiford@arm.com>
* gcc.target/aarch64/torture/simd-abi-10.c: New test.
--- /dev/null
+typedef unsigned int myvec __attribute__((vector_size (16)));
+
+void f (float x)
+{
+ myvec y = x; // { dg-error {cannot convert 'float' to 'myvec' {aka '__vector\([48]\) unsigned int'} in initialization} }
+ myvec *ptr = &x; // { dg-error {cannot convert 'float\*' to 'myvec\*' {aka '__vector\([48]\) unsigned int\*'} in initialization} }
+ const myvec *const_ptr = &x; // { dg-error {cannot convert 'float\*' to 'const myvec\*' {aka 'const __vector\([48]\) unsigned int\*'} in initialization} }
+ volatile myvec *volatile_ptr = &x; // { dg-error {cannot convert 'float\*' to 'volatile myvec\*' {aka 'volatile __vector\([48]\) unsigned int\*'} in initialization} }
+}
--- /dev/null
+typedef unsigned int myvec __attribute__((vector_size (16)));
+
+void f (float x)
+{
+ myvec y = x; /* { dg-error {incompatible types when initializing type 'myvec' {aka '__vector\([48]\) unsigned int'} using type 'float'} } */
+ myvec *ptr = &x; /* { dg-error {initialization of 'myvec \*' {aka '__vector\([48]\) unsigned int \*'} from incompatible pointer type 'float \*'} } */
+ const myvec *const_ptr = &x; /* { dg-error {initialization of 'const myvec \*' {aka 'const __vector\([48]\) unsigned int \*'} from incompatible pointer type 'float \*'} } */
+ volatile myvec *volatile_ptr = &x; /* { dg-error {initialization of 'volatile myvec \*' {aka 'volatile __vector\([48]\) unsigned int \*'} from incompatible pointer type 'float \*'} } */
+}
--- /dev/null
+#include <arm_neon.h>
+
+typedef int16x4_t myvec;
+
+void f (float x)
+{
+ __Int8x8_t y1 = x; /* { dg-error {incompatible types when initializing type '__Int8x8_t' using type 'float'} } */
+ __Int8x8_t *ptr1 = &x; /* { dg-error {initialization of '__Int8x8_t \*' from incompatible pointer type 'float \*'} } */
+ int8x8_t y2 = x; /* { dg-error {incompatible types when initializing type 'int8x8_t' using type 'float'} } */
+ int8x8_t *ptr2 = &x; /* { dg-error {initialization of 'int8x8_t \*' from incompatible pointer type 'float \*'} } */
+ /* ??? For these it would be better to print an aka for 'int16x4_t'. */
+ myvec y3 = x; /* { dg-error {incompatible types when initializing type 'myvec' using type 'float'} } */
+ myvec *ptr3 = &x; /* { dg-error {initialization of 'myvec \*' from incompatible pointer type 'float \*'} } */
+}