Silverfrost Forums

Welcome to our forums

Compiler error with /ISO

9 Nov 2020 10:00 #26570

The following code will not compile with versions 8.61 or 8.66 when /ISO is used.

This is a short demonstration, extracted from a larger code where /ISO is required to ensure that SIZE returns a default integer (in line with the Fortran standard) rather than a 64 bit integer.

module mmm

   type y_t
      integer :: n
   end type y_t

   type x_t
      integer :: m
      type (y_t), pointer :: y(:) => null()
   end type x_t

contains

   subroutine create

      type(x_t), pointer :: x(:)

      allocate(x(1))
      allocate(x(1)%y(1))

   end subroutine create

end module mmm

The compiler error is:

*** '@' found after Alloc where a comma was expected. *** Unexpected '@' in expression.

This compiles correctly with an older version of the compiler (7.2).

If I make a small change to the code it doesn't compile with or without using /ISO, with a different error message:

*** Alloc@1 is an array, so must have bounds specified in the ALLOCATE statement *** '<NUL>' found where ')' was expected

module mmm

   type y_t
      integer :: n
   end type y_t

   type x_t
      integer :: m
      type (y_t), pointer :: y(:) => null()
   end type x_t

contains

   subroutine create

      type(x_t), pointer :: x(:)

      allocate(x(1))
      x(1)%m = 1
      allocate(x(1)%y(x(1)%m))

   end subroutine create

end module mmm
9 Nov 2020 12:43 #26572

Thank you for the feedback.

This failure appears in v8.66 but not in my developers' version. So the problem will be resolved in the next release of FTN95.

30 Dec 2020 6:24 #26852

This test case is working now in 8.70. Thanks Paul.

Please login to reply.