-
Notifications
You must be signed in to change notification settings - Fork 182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix compilation error for NAG #300
Conversation
NAG detects a duplicated name for error_handler which is defined as module procedure as well as the name of the interface of said procedure: Error: src/stdlib_bitsets.f90, line 2131: ERROR_HANDLER previously declared as a generic procedure name detected at ERROR_HANDLER@(
Thanks @awvwgk for this workaround. However, it a bug in the compiler, I am not sure if it is wise to introduce this workaround. |
I'm not sure if this is actually a compiler error, since it flags a name clash between an overloaded interface and a procedure name. Somebody with more detailed knowledge of the standard could probably help out here. |
I am not sure neither. I will just flag a few people: @certik @sblionel @milancurcic @everythingfunctional : any ideas/comments? |
Could I see a small but complete example that shows the problem? I tried to figure it out from the Files Changed but am worried I might be missing something. 15.4.3.4.1p3 says "A generic name may be the same as any one of the procedure names in the generic interface, or the same as any accessible generic name." I haven't thought about this related to submodules. |
A minimal example reproducing the issue would be module stdlib_bitsets
implicit none
private
public :: error_handler
interface error_handler
module subroutine error_handler( message, error, status, &
module, procedure )
character(*), intent(in) :: message
integer, intent(in) :: error
integer, intent(out), optional :: status
character(*), intent(in), optional :: module
character(*), intent(in), optional :: procedure
end subroutine error_handler
end interface error_handler
contains
module subroutine error_handler( message, error, status, module, procedure )
character(*), intent(in) :: message
integer, intent(in) :: error
integer, intent(out), optional :: status
character(*), intent(in), optional :: module
character(*), intent(in), optional :: procedure
! <snip>
end subroutine error_handler
end module stdlib_bitsets Running
Using the module stdlib_bitsets
implicit none
private
public :: error_handler
interface error_handler
module procedure :: error_handler
end interface error_handler
contains
subroutine error_handler( message, error, status, module, procedure )
character(*), intent(in) :: message
integer, intent(in) :: error
integer, intent(out), optional :: status
character(*), intent(in), optional :: module
character(*), intent(in), optional :: procedure
! <snip>
end subroutine error_handler
end module stdlib_bitsets |
Thanks. I don't see a problem with this code. ifort doesn't complain, but I can confirm a recent NAG does. I'll ask Malcolm about it. |
Malcolm says, "Thanks for your bug report. I concur that this is a bug. It should be fixed in build 7041." |
I will close this PR since the issue is now fixed upstream. Thanks everybody. |
Thank you for this quick answer. Nice that it will be fixed. |
NAG detects a duplicated name for error_handler which is defined as module procedure as well as the name of the interface of said procedure:
See #108 for discussion on NAG.