# Risk of -fimplicit-none

**URL:** <https://fortran-lang.discourse.group/t/risk-of-fimplicit-none/2038>\
**Category:** Help\
**Created:** [October 9, 2021, 4:29am UTC](https://fortran-lang.discourse.group/t/risk-of-fimplicit-none/2038 "2021-10-09T04:29:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![fortran4r](https://avatars.discourse-cdn.com/v4/letter/f/9de0a6/32.png) [@fortran4r](https://fortran-lang.discourse.group/u/fortran4r)\
**Post date:** [October 9, 2021, 4:29am UTC](https://fortran-lang.discourse.group/t/risk-of-fimplicit-none/2038/1 "2021-10-09T04:29:36Z")

</div>

Are there any risks of using the flag -fimplicit-none? I really cannot stand putting the implicit none in my code anymore.

---

<div class="post-metadata">

**Author:** ![gronki](https://avatars.discourse-cdn.com/v4/letter/g/a88e4f/32.png) [@gronki](https://fortran-lang.discourse.group/u/gronki)\
**Post date:** [October 9, 2021, 9:29am UTC](https://fortran-lang.discourse.group/t/risk-of-fimplicit-none/2038/3 "2021-10-09T09:29:23Z")

</div>

I’d say you cannot write decent code without this option enabled. I always use it _and_ add `implicit none` in my code, just in case someone else who works in the project decided to use the implicit typing. Double protection 😉

---

<div class="post-metadata">

**Author:** ![mecej4](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/mecej4/32/855_2.png) [@mecej4](https://fortran-lang.discourse.group/u/mecej4)\
**Post date:** [October 9, 2021, 9:59am UTC](https://fortran-lang.discourse.group/t/risk-of-fimplicit-none/2038/4 "2021-10-09T09:59:04Z")

</div>

> [@fortran4r](#):
>
> Are there any risks of using the flag -fimplicit-none? I really cannot stand putting it in my code anymore.

It is not clear what exactly “it” stands for. The compiler option that you have in the title, or the related IMPLICIT NONE statement in your source code? Or are you using some build system that takes compiler options from embedded directives in your source code? The possibilities for causing harm without becoming aware are quite numerous.

There are utilities that can add IMPLICIT NONE at appropriate places in source code (especially F77 or earlier code).

There are/have been a few compilers that have a rather risky nature. Based on the philosophy of supporting old complicated build scripts without requiring updating, those compilers may simply ignore compiler options, such as **-fimplicit-none** , that they do not currently support, but may have supported in the past.

---

<div class="post-metadata">

**Author:** ![shahmoradi](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/shahmoradi/32/3151_2.png) [@shahmoradi](https://fortran-lang.discourse.group/u/shahmoradi)\
**Post date:** [October 9, 2021, 7:34pm UTC](https://fortran-lang.discourse.group/t/risk-of-fimplicit-none/2038/5 "2021-10-09T19:34:15Z")

</div>

Intel compiler, for example, (sadly) does not have a similar `implicit none` compiler option. So as kargl said, your codebase will be bound to gfortran forever. I don’t know about the other compilers.

What I do is that I specify `implicit none` in all modules and submodule headers. But if you can forget it, you will forget to put it somewhere sometime. So, I also specify the compiler option whenever it is available. GFortran’s fantastic `-fimplicit-none` has helped to fix more than a few bugs so far in my experience.

---

<div class="post-metadata">

**Author:** ![FortranFan](https://avatars.discourse-cdn.com/v4/letter/f/96bed5/32.png) [@FortranFan](https://fortran-lang.discourse.group/u/FortranFan)\
**Post date:** [October 9, 2021, 8:24pm UTC](https://fortran-lang.discourse.group/t/risk-of-fimplicit-none/2038/6 "2021-10-09T20:24:22Z")

</div>

> [@fortran4r](#):
>
> … I really cannot stand putting it in my code anymore.

@fortran4r , I assume your quoted comment implies you do **not** want to have to add the `implicit none` statement in your Fortran code, can you please confirm?

If so, please note you are not alone.

I’ve come across quite a few coders in teams in industry who have communicated the same want i.e., they do not want to have to introduce `implicit none` is every program unit, particularly `INTERFACE` blocks. Please see this thread: [Eliminate implicit mapping](https://fortran-lang.discourse.group/t/eliminate-implicit-mapping/1612)

As to your question, please note the following: until and unless the standard makes `implicit none` the default and the compiler implementations conform to such true progress, it’s an incalculable risk to avoid it in your codes for actual work.

I, for one, avoid `implicit none` like the plague in any illustrative code I post online - I truly think it’s an abomination the state of Fortran circa 2021 requires it, but that’s just my view. Should I have to “code in anger” using Fortran, I would ensure `implicit none` is in effect explicitly in code in every program unit and `INTERFACE` body. It’s a shame, but that’s just how it is - take it or leave it, and many do leave.
