[Bug fortran/87797] New: Enhancement: Warning for potential name clash of variables/intrinsics...

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug fortran/87797] New: Enhancement: Warning for potential name clash of variables/intrinsics...

jason at gcc dot gnu.org
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: [hidden email]
  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 | Threaded
Open this post in threaded view
|

[Bug fortran/87797] Enhancement: Warning for potential name clash of variables/intrinsics...

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

Eric Gallager <egallager at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
Reply | Threaded
Open this post in threaded view
|

[Bug fortran/87797] Enhancement: Warning for potential name clash of variables/intrinsics...

jason at gcc dot gnu.org
In reply to this post by jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87797

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2019-09-16
                 CC|                            |tkoenig at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Confirmed.
Reply | Threaded
Open this post in threaded view
|

[Bug fortran/87797] Enhancement: Warning for potential name clash of variables/intrinsics...

jason at gcc dot gnu.org
In reply to this post by jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87797

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P5