0

在使用 Csmith 随机 C 程序生成器时,我尝试为 variable 添加一个 GNU C 语言变量扩展属性((vector_size(16)))。

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);

}

其中为 int8_t(如签名字符)、int16_t(如 short)等提供了#define。并且 safe_rshift_func_int16_t_s_s 是内部定义的函数。

使用 gcc 编译上述程序会出现以下错误:

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;
                                                        ^~~~~~~~~~~~~~~~~~~~

属性是不是放错了?我尝试参考此处链接的 GCC 门户中的文档,但无法准确理解此属性的正确用法,请有人指出吗?

在哪里使用这个属性有什么限制吗?感谢社区。!:)

我尝试搜索 SO 和 web,但他们中的大多数人都在谈论使用 typedef 作为他们的解决方案。

4

0 回答 0