flang icon indicating copy to clipboard operation
flang copied to clipboard

cp2k compilation error: Ambiguous interfaces for generic procedure dbcsr_norm

Open shivaramrao opened this issue 5 years ago • 2 comments

flang doesnt compile the reduced test from cp2k .. ODULE dbcsr_operations PUBLIC :: dbcsr_norm INTERFACE dbcsr_norm MODULE PROCEDURE dbcsr_norm_anytype END INTERFACE CONTAINS SUBROUTINE dbcsr_norm_anytype print *, "hello world" END SUBROUTINE END MODULE dbcsr_operations

MODULE dbcsr_api !use dbcsr_operations use dbcsr_operations, only: & dbcsr_norm_prv => dbcsr_norm public::dbcsr_norm private INTERFACE dbcsr_norm MODULE PROCEDURE dbcsr_norm_anytype2 END INTERFACE

contains SUBROUTINE dbcsr_norm_anytype2 print *, "hello world" END SUBROUTINE

subroutine dbcsr_norm print *, "hello world" end subroutine end module

program main use dbcsr_api, only : dbcsr_norm

call dbcsr_norm() end program .. flang cp2k_1.f90 f90-S-0155-Ambiguous interfaces for generic procedure dbcsr_norm (cp2k_1.f90: 35) F90-S-0155-Ambiguous interfaces for generic procedure dbcsr_norm (cp2k_1.f90: 35) F90-S-0155-Ambiguous interfaces for generic procedure dbcsr_norm (cp2k_1.f90: 35) 0 inform, 0 warnings, 3 severes, 0 fatal for main

gfortran compiles the code correctly.

shivaramrao avatar Jul 01 '19 09:07 shivaramrao

I think this may be a bug in gfortran. I get a similar error from two other Fortran compilers I tried (NAG and Intel):

cp2k_1.f90(27): error #6645: The name of the module procedure conflicts with a name in the encompassing scoping unit.   [DBCSR_NORM]
subroutine dbcsr_norm
-----------^
cp2k_1.f90(33): error #7013: This module file was not generated by any release of this compiler.   [DBCSR_API]
use dbcsr_api, only : dbcsr_norm
----^
cp2k_1.f90(35): error #6406: Conflicting attributes or multiple declaration of name.   [DBCSR_NORM]
call dbcsr_norm()
-----^
cp2k_1.f90(33): error #6580: Name in only-list does not exist.   [DBCSR_NORM]
use dbcsr_api, only : dbcsr_norm
----------------------^
compilation aborted for cp2k_1.f90 (code 1)

===== Trying gfortran =====

===== Trying nagfor =====
NAG Fortran Compiler Release 6.2(Chiyoda) Build 6201
Error: cp2k_1.f90, line 27: DBCSR_NORM previously declared as a generic procedure name
       detected at DBCSR_NORM@<end-of-statement>
Warning: cp2k_1.f90, line 30: DBCSR_NORM explicitly imported into DBCSR_API (as DBCSR_NORM_PRV) but not used
[NAG Fortran Compiler pass 1 error termination, 1 error, 1 warning]```

gklimowicz avatar Jul 17 '19 22:07 gklimowicz

does this still occur? AFAIK it was fixed 2 years ago...

pawosm-arm avatar Jun 18 '22 13:06 pawosm-arm