PGF90-S-0038-Symbol error although symbol is defined

Attempting to build code with the PGI (10.2.0) compiler on a Cray XT5 I get the following error:

PGF90-S-0038-Symbol, netcdf, has not been explicitly declared (/tmp/work/underwoo/testing/CM2.1U_Control-1990_E1.M_3A/src/shared/diag_manager/diag_output.F90: 455)

This code is part of a coupled climate model that builds and runs when using the Pathscale and Intel compiler suites.

The file quoted in the error message uses ‘IMPLICIT NONE’, and also has ‘INTEGER, PARAMETER :: NETCDF’'. Also, this variable ‘NETCDF’ is only used twice in this file. Interestingly, if the symbol is renamed everywhere from NETCDF → NETCDF1 the source will compile.

Is there any reason PGI would issue this error even when the symbol is defined? (Again, Pathscale and Intel compilers do not issue a warning or error for this file.)

Code snippet:

MODULE diag_output_mod


  USE mpp_io_mod, ONLY: axistype, fieldtype, mpp_io_init, mpp_open,  mpp_write_meta,&
       & mpp_write, mpp_flush, mpp_close, mpp_get_id, MPP_WRONLY, MPP_OVERWR,&
       & MPP_NETCDF, MPP_MULTI, MPP_SINGLE
  USE mpp_domains_mod, ONLY: domain1d, domain2d, mpp_define_domains, mpp_get_pelist,&
       &  mpp_get_global_domain, mpp_get_compute_domains, null_domain1d, null_domain2d,&
       & OPERATOR(/=), mpp_get_layout, OPERATOR(==)
  USE mpp_mod, ONLY: mpp_npes, mpp_pe
  USE diag_axis_mod, ONLY: diag_axis_init, get_diag_axis, get_axis_length,&
       & get_axis_global_length, get_domain1d, get_domain2d, get_axis_aux, get_tile_count
  USE diag_data_mod, ONLY: diag_fieldtype, diag_global_att_type 
  USE time_manager_mod, ONLY: get_calendar_type, valid_calendar_types
  USE fms_mod, ONLY: error_mesg, mpp_pe, write_version_number, FATAL
  USE platform_mod, ONLY: r8_kind

  IMPLICIT NONE

  PRIVATE
  PUBLIC :: diag_output_init, write_axis_meta_data, write_field_meta_data, done_meta_data,&
       & diag_field_out, diag_flush, diag_fieldtype, get_diag_global_att, set_diag_global_att

  TYPE(diag_global_att_type), SAVE :: diag_global_att

  INTEGER, PARAMETER      :: NETCDF = 1
  INTEGER, PARAMETER      :: mxch  = 128
  INTEGER, PARAMETER      :: mxchl = 256
  INTEGER                 :: current_file_unit = -1
  INTEGER, DIMENSION(2,2) :: max_range = RESHAPE((/ -32767, 32767, -127,   127 /),(/2,2/))
  INTEGER, DIMENSION(2)   :: missval = (/ -32768, -128 /)
  
  INTEGER, PARAMETER      :: max_axis_num = 20
  INTEGER                 :: num_axis_in_file = 0
  INTEGER, DIMENSION(max_axis_num) :: axis_in_file   
  LOGICAL, DIMENSION(max_axis_num) :: time_axis_flag, edge_axis_flag
  TYPE(axistype), DIMENSION(max_axis_num), SAVE :: Axis_types

  LOGICAL :: module_is_initialized = .FALSE.

  CHARACTER(len=128), PRIVATE :: version= &
       '$Id: diag_output.F90,v 17.0.8.1 2010/03/03 14:47:42 sdu Exp $'
  CHARACTER(len=128), PRIVATE :: tagname= &
       '$Name: riga_patch_sdu $'

CONTAINS


  SUBROUTINE diag_output_init(file_name, FORMAT, file_title, file_unit,&
       & all_scalar_or_1d, domain)
    CHARACTER(len=*), INTENT(in)  :: file_name, file_title
    INTEGER         , INTENT(in)  :: FORMAT
    INTEGER         , INTENT(out) :: file_unit
    LOGICAL         , INTENT(in)  :: all_scalar_or_1d
    TYPE(domain2d)  , INTENT(in)  :: domain

    ! real(KIND=r8_kind), dimension(1) :: tdata
    INTEGER :: form, threading, fileset
    TYPE(diag_global_att_type) :: gAtt

    !---- initialize mpp_io ----
    IF ( .NOT.module_is_initialized ) THEN
       CALL mpp_io_init ()
       module_is_initialized = .TRUE.
    END IF
    CALL write_version_number( version, tagname )
   
    !---- set up output file ----
    SELECT CASE (FORMAT)
    CASE (NETCDF)
       form      = MPP_NETCDF
       threading = MPP_MULTI
       fileset   = MPP_MULTI
    CASE default
       ! <ERROR STATUS="FATAL">invalid format</ERROR>
       CALL error_mesg('diag_output_init', 'invalid format', FATAL)
    END SELECT
 
--*--*--*-- NETCDF not used anywere else if file --*--*--*--

Hi underwoo,

I put in a request with GFDL to get a copy of MOMp1. Once approved, I’ll investigate this issue.

In the mean time, can you please post the exact command line used to compile this file and let me know which is line 455.

Thanks,
Mat

Sorry, I assumed an e-mail would be sent when I got a reply.

But our solution was to rename ‘NETCDF’ to ‘NETCDF1’.