OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

536 lines
19 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: package/.../musl/pkg/gcc/0029-c-Fix-bogus-vector-initialisation-error-PR96377.patch
  5. # Copyright (C) 2020 The OpenSDE Project
  6. #
  7. # More information can be found in the files COPYING and README.
  8. #
  9. # This patch file is dual-licensed. It is available under the license the
  10. # patched project is licensed under, as long as it is an OpenSource license
  11. # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
  12. # of the GNU General Public License as published by the Free Software
  13. # Foundation; either version 2 of the License, or (at your option) any later
  14. # version.
  15. # --- SDE-COPYRIGHT-NOTE-END ---
  16. From d6599f89ba558ec2a68d4bc4af15cf3513218054 Mon Sep 17 00:00:00 2001
  17. From: Richard Sandiford <richard.sandiford@arm.com>
  18. Date: Mon, 3 Aug 2020 09:48:36 +0100
  19. Subject: [PATCH 29/30] c: Fix bogus vector initialisation error [PR96377]
  20. One of the problems in this PR was that if we had:
  21. vector_type1 array[] = { vector_value1 };
  22. process_init_element would only treat vector_value1 as initialising
  23. a vector_type1 if they had the same TYPE_MAIN_VARIANT. This has
  24. several problems:
  25. (1) It gives confusing error messages if the vector types are
  26. incompatible. (Tested by gcc.dg/pr96377-1.c.)
  27. (2) It means that we reject code that should be valid with
  28. -flax-vector-conversions. (Tested by gcc.dg/pr96377-2.c.)
  29. (3) On arm and aarch64 targets, it means that we reject some
  30. initializers that mix Advanced SIMD and standard GNU vectors.
  31. These vectors have traditionally had different TYPE_MAIN_VARIANTs
  32. because they have different mangling schemes. (Tested by
  33. gcc.dg/pr96377-[3-6].c.)
  34. (4) It means that we reject SVE initializers that should be valid.
  35. (Tested by gcc.target/aarch64/sve/gnu_vectors_[34].c.)
  36. (5) After r11-1741-g:31427b974ed7b7dd54e2 we reject:
  37. arm_neon_type1 array[] = { k ^ arm_neon_value1 };
  38. because applying the binary operator to arm_neon_value1 strips
  39. the "Advanced SIMD type" attributes that were added in that patch.
  40. Stripping the attributes is problematic for other reasons though,
  41. so that still needs to be fixed separately.
  42. g++.target/aarch64/sve/gnu_vectors_[34].C already pass.
  43. gcc/c/
  44. PR c/96377
  45. * c-typeck.c (process_init_element): Split test for whether to
  46. recurse into a record, union or array into...
  47. (initialize_elementwise_p): ...this new function. Don't recurse
  48. into a vector type if the initialization value is also a vector.
  49. gcc/testsuite/
  50. PR c/96377
  51. * gcc.dg/pr96377-1.c: New test.
  52. * gcc.dg/pr96377-2.c: Likewise.
  53. * gcc.dg/pr96377-3.c: Likewise.
  54. * gcc.dg/pr96377-4.c: Likewise.
  55. * gcc.dg/pr96377-5.c: Likewise.
  56. * gcc.dg/pr96377-6.c: Likewise.
  57. * gcc.target/aarch64/pr96377-1.c: Likewise.
  58. * gcc.target/aarch64/sve/acle/general-c/gnu_vectors_3.c: Likewise.
  59. * gcc.target/aarch64/sve/acle/general-c/gnu_vectors_4.c: Likewise.
  60. * g++.target/aarch64/sve/acle/general-c++/gnu_vectors_3.C: Likewise.
  61. * g++.target/aarch64/sve/acle/general-c++/gnu_vectors_4.C: Likewise.
  62. (cherry picked from commit 7d599ad27b9bcf5165f87710f1abc64bbabd06ae)
  63. ---
  64. gcc/c/c-typeck.c | 59 ++++++++++++++-----
  65. .../sve/acle/general-c++/gnu_vectors_3.C | 15 +++++
  66. .../sve/acle/general-c++/gnu_vectors_4.C | 15 +++++
  67. gcc/testsuite/gcc.dg/pr96377-1.c | 32 ++++++++++
  68. gcc/testsuite/gcc.dg/pr96377-2.c | 31 ++++++++++
  69. gcc/testsuite/gcc.dg/pr96377-3.c | 33 +++++++++++
  70. gcc/testsuite/gcc.dg/pr96377-4.c | 32 ++++++++++
  71. gcc/testsuite/gcc.dg/pr96377-5.c | 33 +++++++++++
  72. gcc/testsuite/gcc.dg/pr96377-6.c | 32 ++++++++++
  73. gcc/testsuite/gcc.target/aarch64/pr96377-1.c | 20 +++++++
  74. .../sve/acle/general-c/gnu_vectors_3.c | 15 +++++
  75. .../sve/acle/general-c/gnu_vectors_4.c | 15 +++++
  76. 12 files changed, 317 insertions(+), 15 deletions(-)
  77. create mode 100644 gcc/testsuite/g++.target/aarch64/sve/acle/general-c++/gnu_vectors_3.C
  78. create mode 100644 gcc/testsuite/g++.target/aarch64/sve/acle/general-c++/gnu_vectors_4.C
  79. create mode 100644 gcc/testsuite/gcc.dg/pr96377-1.c
  80. create mode 100644 gcc/testsuite/gcc.dg/pr96377-2.c
  81. create mode 100644 gcc/testsuite/gcc.dg/pr96377-3.c
  82. create mode 100644 gcc/testsuite/gcc.dg/pr96377-4.c
  83. create mode 100644 gcc/testsuite/gcc.dg/pr96377-5.c
  84. create mode 100644 gcc/testsuite/gcc.dg/pr96377-6.c
  85. create mode 100644 gcc/testsuite/gcc.target/aarch64/pr96377-1.c
  86. create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/gnu_vectors_3.c
  87. create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/gnu_vectors_4.c
  88. diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c
  89. index eb4b641e6bb..58762f10a93 100644
  90. --- a/gcc/c/c-typeck.c
  91. +++ b/gcc/c/c-typeck.c
  92. @@ -9910,6 +9910,47 @@ output_pending_init_elements (int all, struct obstack * braced_init_obstack)
  93. goto retry;
  94. }
  95. +/* Expression VALUE coincides with the start of type TYPE in a braced
  96. + initializer. Return true if we should treat VALUE as initializing
  97. + the first element of TYPE, false if we should treat it as initializing
  98. + TYPE as a whole.
  99. +
  100. + If the initializer is clearly invalid, the question becomes:
  101. + which choice gives the best error message? */
  102. +
  103. +static bool
  104. +initialize_elementwise_p (tree type, tree value)
  105. +{
  106. + if (type == error_mark_node || value == error_mark_node)
  107. + return false;
  108. +
  109. + gcc_checking_assert (TYPE_MAIN_VARIANT (type) == type);
  110. +
  111. + tree value_type = TREE_TYPE (value);
  112. + if (value_type == error_mark_node)
  113. + return false;
  114. +
  115. + /* GNU vectors can be initialized elementwise. However, treat any
  116. + kind of vector value as initializing the vector type as a whole,
  117. + regardless of whether the value is a GNU vector. Such initializers
  118. + are valid if and only if they would have been valid in a non-braced
  119. + initializer like:
  120. +
  121. + TYPE foo = VALUE;
  122. +
  123. + so recursing into the vector type would be at best confusing or at
  124. + worst wrong. For example, when -flax-vector-conversions is in effect,
  125. + it's possible to initialize a V8HI from a V4SI, even though the vectors
  126. + have different element types and different numbers of elements. */
  127. + if (gnu_vector_type_p (type))
  128. + return !VECTOR_TYPE_P (value_type);
  129. +
  130. + if (AGGREGATE_TYPE_P (type))
  131. + return type != TYPE_MAIN_VARIANT (value_type);
  132. +
  133. + return false;
  134. +}
  135. +
  136. /* Add one non-braced element to the current constructor level.
  137. This adjusts the current position within the constructor's type.
  138. This may also start or terminate implicit levels
  139. @@ -10089,11 +10130,7 @@ process_init_element (location_t loc, struct c_expr value, bool implicit,
  140. /* Otherwise, if we have come to a subaggregate,
  141. and we don't have an element of its type, push into it. */
  142. else if (value.value != NULL_TREE
  143. - && value.value != error_mark_node
  144. - && TYPE_MAIN_VARIANT (TREE_TYPE (value.value)) != fieldtype
  145. - && (fieldcode == RECORD_TYPE || fieldcode == ARRAY_TYPE
  146. - || fieldcode == UNION_TYPE
  147. - || gnu_vector_type_p (fieldtype)))
  148. + && initialize_elementwise_p (fieldtype, value.value))
  149. {
  150. push_init_level (loc, 1, braced_init_obstack);
  151. continue;
  152. @@ -10181,11 +10218,7 @@ process_init_element (location_t loc, struct c_expr value, bool implicit,
  153. /* Otherwise, if we have come to a subaggregate,
  154. and we don't have an element of its type, push into it. */
  155. else if (value.value != NULL_TREE
  156. - && value.value != error_mark_node
  157. - && TYPE_MAIN_VARIANT (TREE_TYPE (value.value)) != fieldtype
  158. - && (fieldcode == RECORD_TYPE || fieldcode == ARRAY_TYPE
  159. - || fieldcode == UNION_TYPE
  160. - || gnu_vector_type_p (fieldtype)))
  161. + && initialize_elementwise_p (fieldtype, value.value))
  162. {
  163. push_init_level (loc, 1, braced_init_obstack);
  164. continue;
  165. @@ -10224,11 +10257,7 @@ process_init_element (location_t loc, struct c_expr value, bool implicit,
  166. /* Otherwise, if we have come to a subaggregate,
  167. and we don't have an element of its type, push into it. */
  168. else if (value.value != NULL_TREE
  169. - && value.value != error_mark_node
  170. - && TYPE_MAIN_VARIANT (TREE_TYPE (value.value)) != elttype
  171. - && (eltcode == RECORD_TYPE || eltcode == ARRAY_TYPE
  172. - || eltcode == UNION_TYPE
  173. - || gnu_vector_type_p (elttype)))
  174. + && initialize_elementwise_p (elttype, value.value))
  175. {
  176. push_init_level (loc, 1, braced_init_obstack);
  177. continue;
  178. diff --git a/gcc/testsuite/g++.target/aarch64/sve/acle/general-c++/gnu_vectors_3.C b/gcc/testsuite/g++.target/aarch64/sve/acle/general-c++/gnu_vectors_3.C
  179. new file mode 100644
  180. index 00000000000..e607d58d726
  181. --- /dev/null
  182. +++ b/gcc/testsuite/g++.target/aarch64/sve/acle/general-c++/gnu_vectors_3.C
  183. @@ -0,0 +1,15 @@
  184. +/* { dg-options "-msve-vector-bits=256" } */
  185. +
  186. +#include <arm_sve.h>
  187. +
  188. +typedef uint8_t gnu_uint8_t __attribute__ ((vector_size (32)));
  189. +typedef int8_t gnu_int8_t __attribute__ ((vector_size (32)));
  190. +
  191. +void
  192. +f (svuint8_t sve_u1, svint8_t sve_s1,
  193. + gnu_uint8_t gnu_u1, gnu_int8_t gnu_s1)
  194. +{
  195. + gnu_uint8_t arr1[] = { gnu_u1, sve_u1 };
  196. + gnu_uint8_t arr2[] = { gnu_s1 }; // { dg-error "cannot convert" }
  197. + gnu_uint8_t arr3[] = { sve_s1 }; // { dg-error "cannot convert" }
  198. +}
  199. diff --git a/gcc/testsuite/g++.target/aarch64/sve/acle/general-c++/gnu_vectors_4.C b/gcc/testsuite/g++.target/aarch64/sve/acle/general-c++/gnu_vectors_4.C
  200. new file mode 100644
  201. index 00000000000..ac4e0d12ff8
  202. --- /dev/null
  203. +++ b/gcc/testsuite/g++.target/aarch64/sve/acle/general-c++/gnu_vectors_4.C
  204. @@ -0,0 +1,15 @@
  205. +/* { dg-options "-msve-vector-bits=256 -flax-vector-conversions" } */
  206. +
  207. +#include <arm_sve.h>
  208. +
  209. +typedef uint8_t gnu_uint8_t __attribute__ ((vector_size (32)));
  210. +typedef int8_t gnu_int8_t __attribute__ ((vector_size (32)));
  211. +
  212. +void
  213. +f (svuint8_t sve_u1, svint8_t sve_s1,
  214. + gnu_uint8_t gnu_u1, gnu_int8_t gnu_s1)
  215. +{
  216. + gnu_uint8_t arr1[] = { gnu_u1, sve_u1 };
  217. + gnu_uint8_t arr2[] = { gnu_s1 };
  218. + gnu_uint8_t arr3[] = { sve_s1 };
  219. +}
  220. diff --git a/gcc/testsuite/gcc.dg/pr96377-1.c b/gcc/testsuite/gcc.dg/pr96377-1.c
  221. new file mode 100644
  222. index 00000000000..2bf3f816331
  223. --- /dev/null
  224. +++ b/gcc/testsuite/gcc.dg/pr96377-1.c
  225. @@ -0,0 +1,32 @@
  226. +/* { dg-options "-fno-lax-vector-conversions" } */
  227. +/* { dg-message "use '-flax-vector-conversions' to permit conversions" "" { target *-*-* } 0 } */
  228. +
  229. +typedef int v4si __attribute__((vector_size(16)));
  230. +typedef short v8hi __attribute__((vector_size(16)));
  231. +
  232. +struct s { v8hi x; v4si y; };
  233. +union u1 { v8hi x; v4si y; };
  234. +union u2 { v4si s; v8hi y; };
  235. +
  236. +void
  237. +foo (v4si i, v8hi h)
  238. +{
  239. + struct s x1 = { i, i }; // { dg-error "incompatible types when initializing type '__vector" }
  240. + struct s x2 = { h, h }; // { dg-error "incompatible types" }
  241. + struct s x3 = { i, h }; // { dg-error "incompatible types" }
  242. + struct s x4 = { h, i };
  243. +
  244. + union u1 y1 = { i }; // { dg-error "incompatible types" }
  245. + union u1 y2 = { h };
  246. + union u2 y3 = { i };
  247. + union u2 y4 = { h }; // { dg-error "incompatible types" }
  248. +
  249. + v4si z1[] = { i, i };
  250. + v4si z2[] = { i, h }; // { dg-error "incompatible types" }
  251. + v4si z3[] = { h, i }; // { dg-error "incompatible types" }
  252. + v4si z4[] = { h, h }; // { dg-error "incompatible types" }
  253. + v8hi z5[] = { i, i }; // { dg-error "incompatible types" }
  254. + v8hi z6[] = { i, h }; // { dg-error "incompatible types" }
  255. + v8hi z7[] = { h, i }; // { dg-error "incompatible types" }
  256. + v8hi z8[] = { h, h };
  257. +}
  258. diff --git a/gcc/testsuite/gcc.dg/pr96377-2.c b/gcc/testsuite/gcc.dg/pr96377-2.c
  259. new file mode 100644
  260. index 00000000000..f58b06d9076
  261. --- /dev/null
  262. +++ b/gcc/testsuite/gcc.dg/pr96377-2.c
  263. @@ -0,0 +1,31 @@
  264. +/* { dg-options "-flax-vector-conversions" } */
  265. +
  266. +typedef int v4si __attribute__((vector_size(16)));
  267. +typedef short v8hi __attribute__((vector_size(16)));
  268. +
  269. +struct s { v8hi x; v4si y; };
  270. +union u1 { v8hi x; v4si y; };
  271. +union u2 { v4si s; v8hi y; };
  272. +
  273. +void
  274. +foo (v4si i, v8hi h)
  275. +{
  276. + struct s x1 = { i, i };
  277. + struct s x2 = { h, h };
  278. + struct s x3 = { i, h };
  279. + struct s x4 = { h, i };
  280. +
  281. + union u1 y1 = { i };
  282. + union u1 y2 = { h };
  283. + union u2 y3 = { i };
  284. + union u2 y4 = { h };
  285. +
  286. + v4si z1[] = { i, i };
  287. + v4si z2[] = { i, h };
  288. + v4si z3[] = { h, i };
  289. + v4si z4[] = { h, h };
  290. + v8hi z5[] = { i, i };
  291. + v8hi z6[] = { i, h };
  292. + v8hi z7[] = { h, i };
  293. + v8hi z8[] = { h, h };
  294. +}
  295. diff --git a/gcc/testsuite/gcc.dg/pr96377-3.c b/gcc/testsuite/gcc.dg/pr96377-3.c
  296. new file mode 100644
  297. index 00000000000..66dce01f277
  298. --- /dev/null
  299. +++ b/gcc/testsuite/gcc.dg/pr96377-3.c
  300. @@ -0,0 +1,33 @@
  301. +/* { dg-do compile { target aarch64*-*-* } } */
  302. +/* { dg-options "-fno-lax-vector-conversions" } */
  303. +/* { dg-message "use '-flax-vector-conversions' to permit conversions" "" { target *-*-* } 0 } */
  304. +
  305. +typedef int v4si __attribute__((vector_size(16)));
  306. +typedef short v8hi __attribute__((vector_size(16)));
  307. +
  308. +struct s { v8hi x; v4si y; };
  309. +union u1 { v8hi x; v4si y; };
  310. +union u2 { v4si s; v8hi y; };
  311. +
  312. +void
  313. +foo (__Int32x4_t i, __Int16x8_t h)
  314. +{
  315. + struct s x1 = { i, i }; // { dg-error "incompatible types when initializing type '__vector" }
  316. + struct s x2 = { h, h }; // { dg-error "incompatible types" }
  317. + struct s x3 = { i, h }; // { dg-error "incompatible types" }
  318. + struct s x4 = { h, i };
  319. +
  320. + union u1 y1 = { i }; // { dg-error "incompatible types" }
  321. + union u1 y2 = { h };
  322. + union u2 y3 = { i };
  323. + union u2 y4 = { h }; // { dg-error "incompatible types" }
  324. +
  325. + v4si z1[] = { i, i };
  326. + v4si z2[] = { i, h }; // { dg-error "incompatible types" }
  327. + v4si z3[] = { h, i }; // { dg-error "incompatible types" }
  328. + v4si z4[] = { h, h }; // { dg-error "incompatible types" }
  329. + v8hi z5[] = { i, i }; // { dg-error "incompatible types" }
  330. + v8hi z6[] = { i, h }; // { dg-error "incompatible types" }
  331. + v8hi z7[] = { h, i }; // { dg-error "incompatible types" }
  332. + v8hi z8[] = { h, h };
  333. +}
  334. diff --git a/gcc/testsuite/gcc.dg/pr96377-4.c b/gcc/testsuite/gcc.dg/pr96377-4.c
  335. new file mode 100644
  336. index 00000000000..f7aaf490031
  337. --- /dev/null
  338. +++ b/gcc/testsuite/gcc.dg/pr96377-4.c
  339. @@ -0,0 +1,32 @@
  340. +/* { dg-do compile { target aarch64*-*-* } } */
  341. +/* { dg-options "-flax-vector-conversions" } */
  342. +
  343. +typedef int v4si __attribute__((vector_size(16)));
  344. +typedef short v8hi __attribute__((vector_size(16)));
  345. +
  346. +struct s { v8hi x; v4si y; };
  347. +union u1 { v8hi x; v4si y; };
  348. +union u2 { v4si s; v8hi y; };
  349. +
  350. +void
  351. +foo (__Int32x4_t i, __Int16x8_t h)
  352. +{
  353. + struct s x1 = { i, i };
  354. + struct s x2 = { h, h };
  355. + struct s x3 = { i, h };
  356. + struct s x4 = { h, i };
  357. +
  358. + union u1 y1 = { i };
  359. + union u1 y2 = { h };
  360. + union u2 y3 = { i };
  361. + union u2 y4 = { h };
  362. +
  363. + v4si z1[] = { i, i };
  364. + v4si z2[] = { i, h };
  365. + v4si z3[] = { h, i };
  366. + v4si z4[] = { h, h };
  367. + v8hi z5[] = { i, i };
  368. + v8hi z6[] = { i, h };
  369. + v8hi z7[] = { h, i };
  370. + v8hi z8[] = { h, h };
  371. +}
  372. diff --git a/gcc/testsuite/gcc.dg/pr96377-5.c b/gcc/testsuite/gcc.dg/pr96377-5.c
  373. new file mode 100644
  374. index 00000000000..3d0c24befa6
  375. --- /dev/null
  376. +++ b/gcc/testsuite/gcc.dg/pr96377-5.c
  377. @@ -0,0 +1,33 @@
  378. +/* { dg-do compile { target aarch64*-*-* } } */
  379. +/* { dg-options "-fno-lax-vector-conversions" } */
  380. +/* { dg-message "use '-flax-vector-conversions' to permit conversions" "" { target *-*-* } 0 } */
  381. +
  382. +typedef int v4si __attribute__((vector_size(16)));
  383. +typedef short v8hi __attribute__((vector_size(16)));
  384. +
  385. +struct s { __Int16x8_t x; __Int32x4_t y; };
  386. +union u1 { __Int16x8_t x; __Int32x4_t y; };
  387. +union u2 { __Int32x4_t s; __Int16x8_t y; };
  388. +
  389. +void
  390. +foo (v4si i, v8hi h)
  391. +{
  392. + struct s x1 = { i, i }; // { dg-error "incompatible types when initializing type '__Int16x8_t" }
  393. + struct s x2 = { h, h }; // { dg-error "incompatible types" }
  394. + struct s x3 = { i, h }; // { dg-error "incompatible types" }
  395. + struct s x4 = { h, i };
  396. +
  397. + union u1 y1 = { i }; // { dg-error "incompatible types" }
  398. + union u1 y2 = { h };
  399. + union u2 y3 = { i };
  400. + union u2 y4 = { h }; // { dg-error "incompatible types" }
  401. +
  402. + v4si z1[] = { i, i };
  403. + v4si z2[] = { i, h }; // { dg-error "incompatible types" }
  404. + v4si z3[] = { h, i }; // { dg-error "incompatible types" }
  405. + v4si z4[] = { h, h }; // { dg-error "incompatible types" }
  406. + v8hi z5[] = { i, i }; // { dg-error "incompatible types" }
  407. + v8hi z6[] = { i, h }; // { dg-error "incompatible types" }
  408. + v8hi z7[] = { h, i }; // { dg-error "incompatible types" }
  409. + v8hi z8[] = { h, h };
  410. +}
  411. diff --git a/gcc/testsuite/gcc.dg/pr96377-6.c b/gcc/testsuite/gcc.dg/pr96377-6.c
  412. new file mode 100644
  413. index 00000000000..165327fa292
  414. --- /dev/null
  415. +++ b/gcc/testsuite/gcc.dg/pr96377-6.c
  416. @@ -0,0 +1,32 @@
  417. +/* { dg-do compile { target aarch64*-*-* } } */
  418. +/* { dg-options "-flax-vector-conversions" } */
  419. +
  420. +typedef int v4si __attribute__((vector_size(16)));
  421. +typedef short v8hi __attribute__((vector_size(16)));
  422. +
  423. +struct s { __Int16x8_t x; __Int32x4_t y; };
  424. +union u1 { __Int16x8_t x; __Int32x4_t y; };
  425. +union u2 { __Int32x4_t s; __Int16x8_t y; };
  426. +
  427. +void
  428. +foo (v4si i, v8hi h)
  429. +{
  430. + struct s x1 = { i, i };
  431. + struct s x2 = { h, h };
  432. + struct s x3 = { i, h };
  433. + struct s x4 = { h, i };
  434. +
  435. + union u1 y1 = { i };
  436. + union u1 y2 = { h };
  437. + union u2 y3 = { i };
  438. + union u2 y4 = { h };
  439. +
  440. + v4si z1[] = { i, i };
  441. + v4si z2[] = { i, h };
  442. + v4si z3[] = { h, i };
  443. + v4si z4[] = { h, h };
  444. + v8hi z5[] = { i, i };
  445. + v8hi z6[] = { i, h };
  446. + v8hi z7[] = { h, i };
  447. + v8hi z8[] = { h, h };
  448. +}
  449. diff --git a/gcc/testsuite/gcc.target/aarch64/pr96377-1.c b/gcc/testsuite/gcc.target/aarch64/pr96377-1.c
  450. new file mode 100644
  451. index 00000000000..51e3e36edfc
  452. --- /dev/null
  453. +++ b/gcc/testsuite/gcc.target/aarch64/pr96377-1.c
  454. @@ -0,0 +1,20 @@
  455. +/* { dg-options "" } */
  456. +
  457. +#include <arm_neon.h>
  458. +
  459. +struct aegis128_state {
  460. + uint8x16_t v[5];
  461. +};
  462. +
  463. +void foo(const void *key, const void *iv, const void *const0, const void *const1)
  464. +{
  465. + uint8x16_t k = vld1q_u8(key);
  466. + uint8x16_t kiv = k ^ vld1q_u8(iv);
  467. + struct aegis128_state st = {{
  468. + kiv,
  469. + vld1q_u8(const1),
  470. + vld1q_u8(const0),
  471. + k ^ vld1q_u8(const0),
  472. + k ^ vld1q_u8(const1),
  473. + }};
  474. +}
  475. diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/gnu_vectors_3.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/gnu_vectors_3.c
  476. new file mode 100644
  477. index 00000000000..0f1a2b0e46b
  478. --- /dev/null
  479. +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/gnu_vectors_3.c
  480. @@ -0,0 +1,15 @@
  481. +/* { dg-options "-msve-vector-bits=256" } */
  482. +
  483. +#include <arm_sve.h>
  484. +
  485. +typedef uint8_t gnu_uint8_t __attribute__ ((vector_size (32)));
  486. +typedef int8_t gnu_int8_t __attribute__ ((vector_size (32)));
  487. +
  488. +void
  489. +f (svuint8_t sve_u1, svint8_t sve_s1,
  490. + gnu_uint8_t gnu_u1, gnu_int8_t gnu_s1)
  491. +{
  492. + gnu_uint8_t arr1[] = { gnu_u1, sve_u1 };
  493. + gnu_uint8_t arr2[] = { gnu_s1 }; // { dg-error "incompatible types" }
  494. + gnu_uint8_t arr3[] = { sve_s1 }; // { dg-error "incompatible types" }
  495. +}
  496. diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/gnu_vectors_4.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/gnu_vectors_4.c
  497. new file mode 100644
  498. index 00000000000..ac4e0d12ff8
  499. --- /dev/null
  500. +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/gnu_vectors_4.c
  501. @@ -0,0 +1,15 @@
  502. +/* { dg-options "-msve-vector-bits=256 -flax-vector-conversions" } */
  503. +
  504. +#include <arm_sve.h>
  505. +
  506. +typedef uint8_t gnu_uint8_t __attribute__ ((vector_size (32)));
  507. +typedef int8_t gnu_int8_t __attribute__ ((vector_size (32)));
  508. +
  509. +void
  510. +f (svuint8_t sve_u1, svint8_t sve_s1,
  511. + gnu_uint8_t gnu_u1, gnu_int8_t gnu_s1)
  512. +{
  513. + gnu_uint8_t arr1[] = { gnu_u1, sve_u1 };
  514. + gnu_uint8_t arr2[] = { gnu_s1 };
  515. + gnu_uint8_t arr3[] = { sve_s1 };
  516. +}
  517. --
  518. 2.27.0