fortran - pgf90 在使用可选逻辑参数时导致分段错误
问题描述
只需看以下简单代码:
program hello
call foo()
contains
subroutine foo(bar)
logical, intent(in), optional :: bar
if (present(bar) .and. bar) then
print *, 'hello'
end if
end subroutine foo
end program hello
编译的时候pgf90
报错Segmentation fault: 11
,使用的时候没问题gfortran
。问题应该在 处present(bar) .and. bar
,但bar
没有给出时,present(bar)
将被评估为.false.
,并且bar
不应评估以下内容,在这种情况下为空。
解决方案
推荐阅读
- excel - 达克斯。根据另一列的最大值获取一列的值
- c# - HttpClient 在 IIS 上的 ASP.NET Core 上返回错误 404,但适用于 IIS Express
- amazon-web-services - 外部用户的 Redshift?
- javascript - 如何使用 Vue.js 删除嵌套的 Firebase 数据
- angular - 无效的元素状态:元素必须是用户可编辑的,以清除它尝试单击并使用 Selenium 在下拉切换中插入日期的错误
- svg - SVG 异物内的文本不可见
- python - Pandas - 在保留索引的同时将列拆分为行
- swift - 是否可以从 Any 类型中获取他的 UnsafeRawPointer 和长度?
- javascript - 在父组件内使用组件的多个实例
- python - Python pandas 将两个数据集的两列转换为一列,保留列名和数据类型