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

            Bug ID: 89555
           Summary: Unable to resolve masking of a type with a local
                    variable of the same name
           Product: gcc
           Version: 8.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: makubesu at gmail dot com
  Target Milestone: ---

I believe there is a bug with variable names which are masking a type. I
apologize if this is a duplicate, I wasn't able to find this bug by searching.

Output of gcc -v:
Using built-in specs.
COLLECT_GCC=gcc-8
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc/8.3.0/libexec/gcc/x86_64-apple-darwin18.2.0/8.3.0/lto-wrapper
Target: x86_64-apple-darwin18.2.0
Configured with: ../configure --build=x86_64-apple-darwin18.2.0
--prefix=/usr/local/Cellar/gcc/8.3.0
--libdir=/usr/local/Cellar/gcc/8.3.0/lib/gcc/8 --disable-nls
--enable-checking=release --enable-languages=c,c++,objc,obj-c++,fortran
--program-suffix=-8 --with-gmp=/usr/local/opt/gmp
--with-mpfr=/usr/local/opt/mpfr --with-mpc=/usr/local/opt/libmpc
--with-isl=/usr/local/opt/isl --with-system-zlib --with-pkgversion='Homebrew
GCC 8.3.0' --with-bugurl=https://github.com/Homebrew/homebrew-core/issues
--disable-multilib --with-native-system-header-dir=/usr/include
--with-sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk
Thread model: posix
gcc version 8.3.0 (Homebrew GCC 8.3.0) 

Command line which triggers the bug:
gfortran -c mask.f90

Exact output:
mask.f90:3:11:

   TYPE :: T
           1
Error: Symbol 't' at (1) has no IMPLICIT type

The exact code of mask.f90:
MODULE mask
  IMPLICIT NONE
  TYPE :: T
  END TYPE
  INTERFACE Fun
    MODULE PROCEDURE G
    MODULE PROCEDURE H
  END INTERFACE
CONTAINS
  SUBROUTINE F
    INTEGER :: T
    !WRITE(*,*) T
    CALL Fun(T)
  END SUBROUTINE
  SUBROUTINE G(x)
    INTEGER :: x
  END SUBROUTINE
  SUBROUTINE H(x)
    TYPE(T) :: x
  END SUBROUTINE
END MODULE

Note that if you un-comment the write statement, the code now compiles.

Reply via email to