-gen-interfaces drops Allocatable and Optional (for Types)

-gen-interfaces drops Allocatable and Optional (for Types)

Аватар пользователя mat_cross

Hi. I'm using

> ifort --version
ifort (IFORT) 13.0.0 20120731

on

> uname -a
Linux whakarewarewa.nag.co.uk 3.5.3-1.fc17.x86_64 #1 SMP Wed Aug 29 18:46:34 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

The fixes to -gen-interfaces at Version 13 are really appreciated, but there are still some problems.

> cat interface.f90

    Subroutine s(a, b, c, d)
      Implicit None
      Integer, Parameter :: n = 3, k = 8
      Integer, Allocatable :: a
      Type t
      End Type t
      Type (t), Optional :: b
      Integer :: c(n)
      Integer (k) :: d
    End Subroutine s

> ifort -gen-interfaces -c interface.f90 ; cat s__genmod.f90
        !COMPILER-GENERATED INTERFACE MODULE: Thu Sep 13 11:47:10 2012
        MODULE S__genmod
          INTERFACE
            SUBROUTINE S(A,B,C,D)
              TYPE T
              END TYPE T
              INTEGER(KIND=4) :: A
              TYPE (T) :: B
              INTEGER(KIND=4) :: C(3)
              INTEGER(KIND=8) :: D
            END SUBROUTINE S
          END INTERFACE
        END MODULE S__genmod

Note that in the output a is missing Allocatable and b is missing Optional.

As further suggestions, would you consider preserving Parameters in Interfaces instead of semantically replacing them? E.g., preserve c(n) and Integer (Kind=k) :: d in the output?

6 сообщений / 0 новое
Последнее сообщение
Пожалуйста, обратитесь к странице Уведомление об оптимизации для более подробной информации относительно производительности и оптимизации в программных продуктах компании Intel.
Аватар пользователя mat_cross

Are there any thoughts here?

Аватар пользователя Tim Prince

You can't use optional without supplying an explicit interface. Allocatable shouldn't need to be in the interface.

Аватар пользователя Steve Lionel (Intel)

An ALLOCATABLE dummy argument also requires an interface - there is a use for this (when you'll be doing allocation or deallocation in the subroutine) - but most of the time, as Tim suggests, it isn't needed. The .f90 form of the generated interface is just for a human reference - it isn't really intended as a way of creating usable interfaces, though many do. By the time the compiler is generating the interface, all the PARAMETER constant expressions have been resolved.

I note that even though the generated interface ,f90 doesn't include OPTIONAL or ALLOCATABLE, the compiler seems to notice it anyway and does the right checking. I will ask that these attributes be included in the .f90 to help users who look at them.

Steve
Аватар пользователя mat_cross

Tim:

"You can't use optional without supplying an explicit interface. Allocatable shouldn't need to be in the interface."

I have explicit interfaces. My toolchain is using ifort to make sure these are always current.
The standard says that Allocatable is a dummy's characteristic, so it must be in the Interface if it's in the procedure itself.

I'm aware of how to use Allocatable for dummies.

Steve:

"I will ask that these attributes be included in the .f90 to help users who look at them."

Thanks. That will be helpful.

Аватар пользователя Steve Lionel (Intel)

This problem has been fixed for a future major version of the compiler.

Steve

Зарегистрируйтесь, чтобы оставить комментарий.