This is an archive of the discontinued LLVM Phabricator instance.

[flang] Add options to control IMPLICIT NONE
ClosedPublic

Authored by tskeith on Aug 5 2020, 2:17 PM.

Details

Summary

Add -fimplicit-none-type-always to treat each specification-part
like it has IMPLICIT NONE. This is helpful for enforcing good Fortran
programming practices. We might consider something similar for
IMPLICIT NONE(EXTERNAL) as well.

Add -fimplicit-none-type-never to ignore occurrences of IMPLICIT NONE
and IMPLICIT NONE(TYPE). This is to handle cases like the one below,
which violates the standard but it accepted by some compilers:

subroutine s(a, n)
  implicit none
  real :: a(n)
  integer :: n
end

Diff Detail

Event Timeline

tskeith created this revision.Aug 5 2020, 2:17 PM
Herald added a project: Restricted Project. · View Herald Transcript
tskeith requested review of this revision.Aug 5 2020, 2:17 PM
klausler accepted this revision.Aug 5 2020, 2:20 PM
This revision is now accepted and ready to land.Aug 5 2020, 2:20 PM

The gfortran options is -fimplicit-none. It doesn't appear to have an inverse, but following the convention would be -fno-implicit-none. I think there is value using the same spelling for this option.

The gfortran options is -fimplicit-none. It doesn't appear to have an inverse, but following the convention would be -fno-implicit-none. I think there is value using the same spelling for this option.

But -fno-implicit-none would mean "don't assume IMPLICIT NONE where it doesn't appear", not "ignore IMPLICIT NONE where it does appear." Not the same thing.

The gfortran options is -fimplicit-none. It doesn't appear to have an inverse, but following the convention would be -fno-implicit-none. I think there is value using the same spelling for this option.

But -fno-implicit-none would mean "don't assume IMPLICIT NONE where it doesn't appear", not "ignore IMPLICIT NONE where it does appear." Not the same thing.

We may also want an option that means "assume IMPLICIT NONE(EXTERNAL)" everywhere. That's why I included "type" in the option name. gfortran's -fimplicit-none option may pre-date the addition of IMPLICIT NONE(EXTERNAL) to the language.

Also, we can reconsider option names when we have a real driver.

This revision was automatically updated to reflect the committed changes.