我目前使用的是旧代码,它使用不同类型的整数作为参数来调用iand函数。下面是代码所包含内容的一个小示例:
program test
integer*1 i
integer j, k
i = 1
j = 8
k = iand(i, j)
print *, k
end program testgfortran版本8和更早的版本具有使用不同类型的整数调用iand的扩展能力(例如,参见here),而在gfortran 9中删除了该选项(参见this site)。例如,使用gfortran 7.5.0:
gfortran-7 -o test test.f90 && ./test
0但是当使用gfortran 9.2.0编译时,我得到:
gfortran -o test test.f90
...
Error: Arguments of ‘iand’ have different kind type parameters at (1)有没有新版本的gfortran可以让我按原样使用这段代码?
发布于 2020-01-16 15:21:22
不,没有。这个扩展被删除了,因为语义没有很好地指定,并且将代码固定为符合标准的代码很简单。
请参阅https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81509
在您的例子中,如下所示
k = iand(int(i, kind(j)), j)希望这就是你想要的。
https://stackoverflow.com/questions/59756525
复制相似问题