Pointless and warantless compiler warning about specific procedures

Pointless and warantless compiler warning about specific procedures

Why is the 13.1.1 compiler emitting a TKR warning for two specific subroutines for a generic that are clearly distinguishable according to F2008?  Is this some legacy of F2003?  The warning doesn't go away with "-stand f08" either.  Code appears to work correctly, but the warning is disturbing -- makes me wonder whether the compiler knows what it is doing.

Here's an example:

module example
interface generic
module procedure specific_1, specific_2
end interface
contains
subroutine specific_1 (array)
 integer, allocatable :: array(:)
 end subroutine
 subroutine specific_2 (array)
 integer, pointer :: array(:)
 end subroutine
end module

And the warning message from the compiler:

intel-bug-20130330a.F90(14): warning #6738: The type/rank/keyword signature for this specific procedure matches another specific procedure that shares the same generic-name. [SPECIFIC_2]
subroutine specific_2 (array)
-------------^

Both subroutines have a single rank-1 integer array argument, but one is a pointer and the other is allocatable.  Section 12.4.3.4.5 (F2008) says in part: "Two dummy arguments are distinguishable if one has the ALLOCATABLE attribute and the other has the POINTER attribute". 

publicaciones de 6 / 0 nuevos
Último envío
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.

Okay, I was wrong about the code actually working.  In some circumstances it does, like the code above.  However if the arguments are scalars of intrinsic type, or polymorphic, the compiler will throw an error where the generic is called.  So in fact the compiler fails to respect F2008 rules for disambiguating specific procedures.

Here's an example that fails:

module example
 interface generic
 procedure specific_1, specific_2
 end interface
 type foo
 integer n
 end type
contains
 subroutine specific_1 (arg)
 !integer, allocatable :: arg
 class(foo), allocatable :: arg
 end subroutine
 subroutine specific_2 (arg)
 !integer, pointer :: arg
 class(foo), pointer :: arg
 end subroutine
end module
program main
 use example
 !integer, allocatable :: a
 !integer, pointer :: b
 class(foo), allocatable :: a
 class(foo), pointer :: b
 call generic (a)
 call generic (b)
end program

And the error message:

intel-bug-20130330a.F90(13): warning #6738: The type/rank/keyword signature for this specific procedure matches another specific procedure that shares the same generic-name. [SPECIFIC_2]
subroutine specific_2 (arg)
-------------^
intel-bug-20130330a.F90(24): error #8032: Generic procedure reference has two or more specific procedure with the same type/rank/keyword signature. [GENERIC]
call generic (a)
-------^
intel-bug-20130330a.F90(24): error #6691: A pointer dummy argument may only be argument associated with a pointer. [A]
call generic (a)
----------------^
intel-bug-20130330a.F90(25): error #8032: Generic procedure reference has two or more specific procedure with the same type/rank/keyword signature. [GENERIC]
call generic (b)
-------^
compilation aborted for intel-bug-20130330a.F90 (code 1)

You're relying on a language change made in F2008 that we don't yet support, that being the treatment of pointer and allocatable as distinguishing attributes. In F2003, these attributes did not participate in disambiguation.

Steve - Intel Developer Support

Do you have a time frame when you plan on implementing this aspect of F2008?

Incidently, if the compiler is F2003 on this aspect then the compiler warning in my first example should have been an error, and thus is a bug.  

The standard requires only that we have the capability of diagnosing a violation of numbered syntax rules or constraints. It doesn't specify any particular form of diagnosis and allows us to extend the language. In this case you never tried to call the generic, so we didn't give an error. If you had tried to call the generic, then you would have seen an error. No bug here.

I don't have a timeframe for when this feature will be implemented. It is on our list.

Steve - Intel Developer Support

15.0 now distinguishes pointer and allocatable as characteristics.

Steve - Intel Developer Support

Deje un comentario

Por favor inicie sesión para agregar un comentario. ¿No es socio? Únase ya