- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello, i get those two warning messages, when compiling the code below.
"(22) warning #6706: There is a mixture of specific functions and specific subroutines for one generic-spec. [INTF_SETARRAY]"
"(28) warning #6738: The type/rank/keyword signature for this specific procedure matches another specific procedure that shares the same generic-name. [INTF_GETSCALAR]"
I do not understand, what is wrong with those declarations. This contruct seems to work fine in my real code, but the warnings confused me.
Greetings
Wolf
Compiler: 15.5 and 16.1
module FOO
implicit none
!=================================================================
type, abstract :: ABSTRACT_TYPE
contains
procedure(intf_getArray), deferred :: getArray
procedure(intf_setArray), deferred :: setArray
procedure(intf_getScalar), deferred :: getScalar
procedure(intf_setScalar), deferred :: setScalar
end type ABSTRACT_TYPE
!=================================================================
interface abstract
real pure function intf_getArray(this) result(res)
import :: ABSTRACT_TYPE
class(ABSTRACT_TYPE), intent(in ) :: this
end function
pure subroutine intf_setArray(this, inp)
import :: ABSTRACT_TYPE
class(ABSTRACT_TYPE), intent(inout) :: this
real, intent(in ) :: inp(3)
end subroutine
real elemental function intf_getScalar(this) result(laenge)
import :: ABSTRACT_TYPE
class(ABSTRACT_TYPE), intent(in ) :: this
end function
elemental subroutine intf_setScalar(this, inp)
import :: ABSTRACT_TYPE
class(ABSTRACT_TYPE), intent(inout) :: this
real, intent(in ) :: inp
end subroutine
end interface
!=================================================================
type, extends (ABSTRACT_TYPE) :: EXTENDED_TYPE
contains
procedure :: getArray => getArray_Extended
procedure :: getScalar => getScalar_Extended
procedure :: setArray => setArray_Extended
procedure :: setScalar => setScalar_Extended
end type EXTENDED_TYPE
!=================================================================
contains
!=================================================================
pure function getArray_Extended(this) result(res)
class(EXTENDED_TYPE), intent(in ) :: this
real :: res
end function
real elemental function getScalar_Extended(this)
class(EXTENDED_TYPE), intent(in ) :: this
end function
pure subroutine setArray_Extended(this, inp)
class(EXTENDED_TYPE), intent(inout) :: this
real, intent(in ) :: inp(3)
end subroutine
elemental subroutine setScalar_Extended(this, inp)
class(EXTENDED_TYPE), intent(inout) :: this
real, intent(in ) :: inp
end subroutine setScalar_Extended
!=================================================================
end module FOO
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There appears to be a couple of issues here:
- I assume you meant "abstract interface" on line 16 instead of "interface abstract". I would think the line "interface abstract" would signal to the compiler an attempt to provide a generic interface named abstract and in which case the compiler should give an error (not a warning) that all the procedures in said generic need either be all SUBROUTINE or FUNCTION procedures. This would appear to be a bug in the compiler that it does not give such an error.
- If you change your code to "abstract interface", then the code compiles ok but gives "warning #6178: The return value of this FUNCTION has not been defined. [GETSCALAR_EXTENDED]" which also seems spurious, similar to the other thread you created around the same time as this one.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There appears to be a couple of issues here:
- I assume you meant "abstract interface" on line 16 instead of "interface abstract". I would think the line "interface abstract" would signal to the compiler an attempt to provide a generic interface named abstract and in which case the compiler should give an error (not a warning) that all the procedures in said generic need either be all SUBROUTINE or FUNCTION procedures. This would appear to be a bug in the compiler that it does not give such an error.
- If you change your code to "abstract interface", then the code compiles ok but gives "warning #6178: The return value of this FUNCTION has not been defined. [GETSCALAR_EXTENDED]" which also seems spurious, similar to the other thread you created around the same time as this one.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Well, this was obviously my fault. As you said, changing line 16 to "abstract interface", resolves the issue. The warning #6178 seems right to me, as there is no result value given in the function, because i stripped everything unimportant.
Thank you very much FortranFan!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Wolf W. wrote:
.. The warning #6178 seems right to me, as there is no result value given in the function..
I could be wrong but the warning #6178 seems to indicate the compiler doesn't notice the code says "real elemental function getScalar_Extended.."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
"The return value of this FUNCTION has not been defined" means that nothing has been assigned to the return value of the function.
--Lorri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Lorri Menard (Intel) wrote:
"The return value of this FUNCTION has not been defined" means that nothing has been assigned to the return value of the function.
--Lorri
Ok, but then shouldn't the compiler issue the same warning about getArray_Extended function?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
:-) Yes.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page