https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100270

            Bug ID: 100270
           Summary: _Generic can't distinguish VLS SVE vectors and GNU
                    vectors
           Product: gcc
           Version: 10.3.1
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rsandifo at gcc dot gnu.org
  Target Milestone: ---
            Target: aarch64*-*-*

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.

Reply via email to