使用 -fcheck=all 时没有未初始化变量的警告

问题描述

这是一个 Fortran 代码

program sample
  implicit none
  real(8) :: notinit

  notinit= notinit*8
  write(*,*) 'notinit =',notinit
end program sample

gcc version 8.3.0 (Debian 8.3.0-6)

两种情况:

gfortran -O1 -ffree-line-length-0  -Wall -Wno-maybe-uninitialized sample.f90
sample.f90:5:0:

   notinit= notinit*8
 
Warning: ‘notinit’ is used uninitialized in this function [-Wuninitialized]

但是

gfortran -O1 -ffree-line-length-0  -fcheck=all -Wall -Wno-maybe-uninitialized sample.f90

没有警告信息,这是非常错误的。

为什么?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)