This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/66545] ICE on using undefined parameter/variable values


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

--- Comment #2 from Gerhard Steinmetz <gerhard.steinmetz.fortran@t-online.de> ---
FYI, it's astonishing, but this code compiles without an ICE
and prints some reasonable error messages :


$ cat z2_type.f90
program p
   type t
      integer :: n
   end type
   type(t), parameter :: c1 = (t(c1%n))
   type(t), parameter :: c2 = t(c2%n)
   type(t) :: c3 = (t(c3%n))
   type(t) :: c4 = t(c4%n)
   type(t) :: c5
   type(t) :: c6
   c5 = (t(c5%n))
   c6 = t(c6%n)
end


$ gfortran -c z2_type.f90
z2_type.f90:5:33:

    type(t), parameter :: c1 = (t(c1%n))
                                 1
Error: PARAMETER âc1â is used at (1) before its definition is complete
z2_type.f90:6:32:

    type(t), parameter :: c2 = t(c2%n)
                                1
Error: PARAMETER âc2â is used at (1) before its definition is complete
z2_type.f90:7:22:

    type(t) :: c3 = (t(c3%n))
                      1
Error: Parameter âc3â at (1) has not been declared or is a variable, which does
not reduce to a constant expression
z2_type.f90:8:21:

    type(t) :: c4 = t(c4%n)
                     1
Error: Parameter âc4â at (1) has not been declared or is a variable, which does
not reduce to a constant Expression

#
# c5, c6 differs
#

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]