https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87797

            Bug ID: 87797
           Summary: Enhancement: Warning for potential name clash of
                    variables/intrinsics...
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gs...@t-online.de
  Target Milestone: ---

Regarding pr85896 and other issues, an additional Warning -Wxyz=key
(names "xyz" and "key" tbd) might be helpful :

Variant 1 (argument key1) :
  Warn if a _user_defined_ parameter/variable/array/type
  is named like an _intrinsic_ function/subroutine/type/module
  from a dedicated official standard (e.g. -std=f2008).
  See e.g. table of intrinsics in F2008 13.5, 13.6.

Variant 2 (argument key2) :
  Warn if a _user_defined_ function/subroutine/interface/module
  is named like an _intrinsic_ function/subroutine/type/module
  from a dedicated official standard (e.g. -std=f2008).

Knowing that gfortran can _not_ do the job of a static analyzer,
specifically for global analysis, it could mark "suspicious" code
this way. Just an idea.



Additionally :

Variant 3 (argument key3) :
  Warn if a _user_defined_ parameter/variable/array/type
  is named like an official statement name (like "stop").

Variant 4 (argument key4) :
  Warn if a _user_defined_ function/subroutine/interface/module
  is named like an official statement name.

Variant 5 (argument key5) :
  Warn if a _user_defined_ parameter/variable/array/type
  is named like an _user_defined_ function/subroutine/type/module,
  regarding sources in scope/progress.



Example :

$ cat z1.f90
module program
   integer :: function, sin, trim
   type public
      character :: max, else(1)
   end type
end
program end
   use program, len => trim
   real :: select, read(2)
contains
   function module (sin)
      character :: sin, stop
   end
end

Reply via email to