我有一个函数,它的指针为
double
作为限定为
restrict
。请注意,英特尔编译器使用
限制
,但我们将限定符替换为
__restrict__
在GCC的情况下。
void Stats::calc_flux_2nd(double* restrict data,
double* restrict datamean,
double* restrict w)
{
// ...
// Set a pointer to the field that contains w,
// either interpolated or the original
double* restrict calcw = w;
// ...
此代码使用GCC或Clang编译时没有任何问题,但IBM BlueGene编译器给出以下错误:
(W) Incorrect assignment of a restrict qualified pointer.
Only outer-to-inner scope assignments between restrict pointers are
allowed. This may result in incorrect program behavior.
我不知道如何解释这个错误,因为我没有更改变量的签名,也不知道我是否引入了未定义的行为或IBMBlueGene编译器是否错误。