Omitting implicit none

I always use the -fimplicit-none and -Wall GFortran flags. I am curious if I omit -fimplicit-none, will -Wall be able to catch implicit type issues?

No. Compare the documentation entry for -fimplicit-none (under Dialect Options) versus -Wall (under Error and Warning Options)

If -Wall warned for implicitly typed variables, which are part of standard fortran, then a programmer might be swamped with false positive warning messages, making the actual error messages difficult to identify. For programmers who use implicit typing, it would be necessary to introduce a switch that would override that part of -Wall.

If I omit both -fimplicit-none and -Wall for compilation and omit implicit none in Fortran codes, what unexpected errors might I get? I have yet to see an example like that.

Something like this would be the typical error

i0 = 1
write(*,*) iO
end

In case you can’t tell, the Zero and Oh are different characters. Implicit none catches these kinds of typographical errors. In this case, the code is nonconforming because iO is undefined, but in other cases, the code might be conforming but just doesn’t do what is expected.

2 Likes

Thanks for the clarification. This is a perfect example!