GCC language extension __attribute__((vector_size(16))) incompatible type error

232 Views Asked by At

While using Csmith a random C program generator I tried adding a GNU C language variable extension attribute((vector_size(16))) for variable .

static uint64_t  func_1(void)
{/* block id: 0 */
    uint64_t l_6 __attribute__ ((vector_size (64)))  = 0xCD2466E9F08664A1LL;
    int32_t *l_7 /*__attribute__ ((vector_size (16)))*/ = (void*)0;
    int32_t *l_8 /*__attribute__ ((vector_size (16)))*/= &g_9;
    int32_t *l_10 = &g_5.f7;
    int32_t **l_11[10][8][3] = {{{&l_10,&l_10,&l_10},{&l_7,&l_8,&l_8},{&l_8,&l_8,(void*)0},{&l_7,&l_8,&l_10},{&l_8,&l_7,&l_10},{&l_8$
    int32_t *l_13 = &g_9;
    int i, j, k;
    (*l_8) |= (g_2[3] , (safe_rshift_func_int16_t_s_s(0L, (g_5 , (l_6 != g_5.f2)))));
    (*l_10) |= ((g_12 = l_10) != (void*)0);
    l_13 = &g_9;
    return (*l_13);

}

where as there are #define's provided for int8_t(like signed char),int16_t(like short) and so on. and safe_rshift_func_int16_t_s_s is a function internally defined.

compiling the above program with gcc gives following errors:

sam.c: In function ‘func_1’:
sam.c:53:56: error: incompatible types when initializing type ‘__vector(8) long long unsigned int’ using type ‘long long unsigned int’
     uint64_t l_6 __attribute__ ((vector_size (64)))  = 0xCD2466E9F08664A1LL;
                                                        ^~~~~~~~~~~~~~~~~~~~

Is the attribute wrongly placed? I tried referring to the documentation from the GCC portal linked here but unable to understand exactly the correct use of this attribute, please can anyone point them out?

Are there any restrictions so as where to use this attribute? Thanks community. !:)

I tried searching SO and web but most of them talk about use typedef for their solutions.

0

There are 0 best solutions below