Compiling the following test with -march=armv8.2-a+sve -msve-vector-bits=256: --------------------------------------------------------------------------- #include <arm_sve.h> typedef svint32_t vls_svint32_t __attribute__((arm_sve_vector_bits(256))); typedef int32_t gnu_svint32_t __attribute__((vector_size(32))); int f (vls_svint32_t x) { return _Generic(x, vls_svint32_t: 1, gnu_svint32_t: 2, default: -1); } --------------------------------------------------------------------------- gives: a.c: In function ‘f’: a.c:9:40: error: ‘_Generic’ specifies two compatible types 9 | return _Generic(x, vls_svint32_t: 1, gnu_svint32_t: 2, default: -1); | ^~~~~~~~~~~~~ a.c:9:22: note: compatible type is here 9 | return _Generic(x, vls_svint32_t: 1, gnu_svint32_t: 2, default: -1); | ^~~~~~~~~~~~~ a.c:9:40: error: ‘_Generic’ selector matches multiple associations 9 | return _Generic(x, vls_svint32_t: 1, gnu_svint32_t: 2, default: -1); | ^~~~~~~~~~~~~ a.c:9:22: note: other match is here 9 | return _Generic(x, vls_svint32_t: 1, gnu_svint32_t: 2, default: -1); | ^~~~~~~~~~~~~ This is because aarch64_comp_type_attributes needs to return false for this combination of types.
Working on a patch.
The master branch has been updated by Richard Sandiford <rsandifo@gcc.gnu.org>: https://gcc.gnu.org/g:4cea5b8cb715e40e10174e6de405f26202fa3d6a commit r12-147-g4cea5b8cb715e40e10174e6de405f26202fa3d6a Author: Richard Sandiford <richard.sandiford@arm.com> Date: Tue Apr 27 12:18:03 2021 +0100 aarch64: Handle SVE attributes in comp_type_attributes [PR100270] Even though "SVE type" and "SVE sizeless type" are marked as affecting type identity, the middle end doesn't truly believe it unless we also handle them in comp_type_attributes. gcc/ PR target/100270 * config/aarch64/aarch64.c (aarch64_comp_type_attributes): Handle SVE attributes. gcc/testsuite/ PR target/100270 * gcc.target/aarch64/sve/acle/general-c/pr100270_1.c: New test. * gcc.target/aarch64/sve/acle/general-c/sizeless-2.c: Change expected error message when subtracting pointers to different vector types. Expect warnings when mixing them elsewhere. * gcc.target/aarch64/sve/acle/general/attributes_7.c: Remove XFAILs. Tweak error messages for some cases.
The releases/gcc-11 branch has been updated by Richard Sandiford <rsandifo@gcc.gnu.org>: https://gcc.gnu.org/g:dfaa29b5441689ce05e3c09012d3afe269770e94 commit r11-8322-gdfaa29b5441689ce05e3c09012d3afe269770e94 Author: Richard Sandiford <richard.sandiford@arm.com> Date: Thu Apr 29 09:27:51 2021 +0100 aarch64: Handle SVE attributes in comp_type_attributes [PR100270] Even though "SVE type" and "SVE sizeless type" are marked as affecting type identity, the middle end doesn't truly believe it unless we also handle them in comp_type_attributes. gcc/ PR target/100270 * config/aarch64/aarch64.c (aarch64_comp_type_attributes): Handle SVE attributes. gcc/testsuite/ PR target/100270 * gcc.target/aarch64/sve/acle/general-c/pr100270_1.c: New test. * gcc.target/aarch64/sve/acle/general-c/sizeless-2.c: Change expected error message when subtracting pointers to different vector types. Expect warnings when mixing them elsewhere. * gcc.target/aarch64/sve/acle/general/attributes_7.c: Remove XFAILs. Tweak error messages for some cases. (cherry picked from commit 4cea5b8cb715e40e10174e6de405f26202fa3d6a)
GCC 10.4 is being released, retargeting bugs to GCC 10.5.
Fixed in GCC 11.