A gfortran bug on parameterized derived types

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I guess this is a bug to be reported.
Essentially, if I change position of the declaration of the variable n, the
error shows up.
The following code (file is teste.f90):

MODULE TESTET
 IMPLICIT NONE
 INTEGER :: n
 TYPE :: Test(n)
   INTEGER, KIND :: n = 4
   REAL(n) :: v
 END TYPE Test
 PUBLIC Test
END MODULE TESTET

returns an error if:
$ gfortran -c teste.f90
teste.f90:6:8:

    REAL(n) :: v
        1
Error: Parameter ‘n’ at (1) has not been declared or is a variable, which
does not reduce to a constant expression

The error is not issued if I move the declaration of variable n to after
TYPE test specification:

MODULE TESTET
 IMPLICIT NONE
 TYPE :: Test(n)
   INTEGER, KIND :: n = 4
   REAL(n) :: v
 END TYPE Test
 INTEGER :: n
 PUBLIC Test
END MODULE TESTET

Thanks & Regards




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux