Issue: PGF90-S-0044-Multiple declaration for symbol

Hi,

I met such a problem when compiling some fortran codes. The error message is PGF90-S-0044-Multiple declaration for symbol. It complains the line of subroutine as shown below

integer*4 function checkdims (ncid, ncname, lstr, recsize)
      USE Agrif_Util                                                                                    
                                                                                           
      CHARACTER :: ncname*80                                                                            
      INTEGER*4 :: ncid                                                                                 
      INTEGER*4 :: lstr                                                                                 
      INTEGER*4 :: recsize                                                                              
                                                                                                        
      Call Sub_Loop_checkdims( ncid,ncname,lstr,recsize                                                 
     &,checkdims ,  Agrif_tabvars(187) % var% iarray0                                                   
     &,  Agrif_tabvars(188) % var% iarray0 ,  Agrif_tabvars(189)                                        
     &% var% iarray0 ,  Agrif_tabvars(190) % var% iarray0)                                              
                                                                                                        
      end                                                                                               
                                                                                                        
            subroutine Sub_Loop_checkdims(ncid,ncname,lstr                                              
     &,recsize,checkdims,eta_v,eta_rho,xi_u,xi_rho)                                                     
                                                                                                        
      IMPLICIT NONE
      ............
      ............

Is there any idea how to fix this? I am using PGI 12.3

Thanks!!
Yisen

Hi Yisen,

What symbol and where is it being declared twice? Could one of your local variables be declared in the module? Can you provide a reproducing example?

  • Mat

Mat,
I’m helping Yisen with the problem, and I have a reproducible example.

test1.f90 (this is a wrapper for the code that produces the error):

PROGRAM test1
IMPLICIT NONE
INTEGER :: checkdims

print *,‘checkdims returns’,checkdims(3)


END PROGRAM test1


test1_sub.f (this is the code that produces the error):
integer function checkdims (in)
IMPLICIT NONE
INTEGER :: in

checkdims=in*4

Call Sub_Loop_checkdims(checkdims)

contains


subroutine Sub_Loop_checkdims(checkdims)
IMPLICIT NONE
INTEGER :: checkdims

checkdims=checkdims+1
end subroutine Sub_Loop_checkdims



end function checkdims


If I change the “checkdims” variable in Sub_Loop_checkdims to something else (like checkdimss), the code compiles and works just fine.
If the checkdims variable in Sub_Loop_checkdims is left as-is, I get this error:
test1_sub.f:
PGF90-S-0044-Multiple declaration for symbol checkdims (test1_sub.f: 12)
PGF90/x86-64 Linux 11.10-0: compilation completed with severe errors

This happens with PGI 11.10, 12.3, and 12.10

I’m not a fortran expert (I’m not even a fotran novice yet), so I don’t know if the above code is legal, but both the Intel and GNU compilers accept this construct without warning.


Wesley

Thanks Wesley. I’ve sent a report to our compiler engineers (TPR#19232) and asked them to look into the source of the problem,

Best Regards,
Mat

Hi Mat,

Is there any news on this issue?

Thanks
Yisen

Hi Yisen,

Yes, our engineers have this fixed internally, though it looks to be too late to get the fix into 13.4. Most likely 13.5 (May).

Thanks,
Mat

Hi Mat,

Thank you for letting me know this.
I think currently the workaround is just to rename the variable.

Yisen