0034-Syntax error

Hi All,

I have been experiencing difficulties when trying to compile a package of scientific model. It seem like there are some syntax error, and I’ve been searching around the internet for solutions. However, there is no luck until now. Hope you can help me on this.

So the error message goes like this

/home/local/i386/pgi/linux86/6.1/bin/pgf90 -MFree -r8 -Ktrap=fp -pc 64 -silent -c -I/…/nfu.F90
PGF90-S-0034-Syntax error at or near identifier int (/…/getput.inc: 78)
PGF90-S-0034-Syntax error at or near identifier int (/h./getput.inc: 81)
PGF90-S-0034-Syntax error at or near identifier int (/…/getput.inc: 84)
PGF90-S-0034-Syntax error at or near identifier int (/…/getput.inc: 85)
PGF90-S-0034-Syntax error at or near identifier int (/…/getput.inc: 88)
PGF90-S-0034-Syntax error at or near identifier int (/…/getput.inc: 89)
PGF90-S-0034-Syntax error at or near identifier double (/…/getput.inc: 78)
PGF90-S-0034-Syntax error at or near identifier double (/…/getput.inc: 81)
PGF90-S-0034-Syntax error at or near identifier double (/…/getput.inc: 84)
PGF90-S-0034-Syntax error at or near identifier double (/…/getput.inc: 85)
PGF90-S-0034-Syntax error at or near identifier double (/h…/getput.inc: 88)
PGF90-S-0034-Syntax error at or near identifier double (/…/getput.inc: 89)

The content of the lines in getput.inc file:
77 interface nfu_get_var
78 module procedure GET_VAR_D0, GET_VAR_D1, GET_VAR_D2, GET_VAR_D3
79 end interface
80 interface nfu_put_var
81 module procedure PUT_VAR_D0, PUT_VAR_D1, PUT_VAR_D2, PUT_VAR_D3
82 end interface
83 interface nfu_get_rec
84 module procedure GET_REC_D0N, GET_REC_D1N, GET_REC_D2N, GET_REC_D3N
85 module procedure GET_REC_D0I, GET_REC_D1I, GET_REC_D2I, GET_REC_D3I
86 end interface
87 interface nfu_put_rec
88 module procedure PUT_REC_D0N, PUT_REC_D1N, PUT_REC_D2N, PUT_REC_D3N
89 module procedure PUT_REC_D0I, PUT_REC_D1I, PUT_REC_D2I, PUT_REC_D3I
90 end interface

And those procedures have been defined before such as:
45 #define GET_VAR_D0 GET_VAR(NF_TYPE, D0)
and
50 #define PUT_VAR_D0 PUT_VAR(NF_TYPE, D0)
and
55 #define GET_REC_D0N GET_REC(NF_TYPE, D0N)
and etc…

And I think the corresponding parts in the nfu.F90 file are
11 public :: nfu_put_var, nfu_put_rec
12 public :: nfu_get_var, nfu_get_rec
.
.
495 function nfu_get_dim(ncid, dimid, x) result(iret)
496 integer, intent(in) :: ncid,dimid
497 real , intent(out) :: x(:)
498 integer :: iret
499
500 integer :: varid
501 character(len=NF_MAX_NAME) :: name
502
503 NF_TRY(nf_inq_dimname(ncid,dimid,name),iret,7)
504 NF_TRY(nf_inq_varid(ncid,name,varid),iret,7)
505 NF_TRY(nf_get_var_double(ncid,varid,x),iret,7)
506
507 7 return
508 end function
.
.
544 #define F90_TYPE integer
545 #define NF_TYPE int
546 #include “getput.inc”
547
548 #define F90_TYPE real(8)
549 #define NF_TYPE double
550 #include “getput.inc”

It will very appreciated if someone can help me on this…

Chiyu

Hi Chiyu,

It looks like the the “F90_TYPE” should be used instead of “NF_TYPE”. By using “NF_TYPE”, the C data types “int” and “double” are being used instead of the Fortran “integer” and “real(8)”.

Exactly why “NF_TYPE” is being used, I’m not sure. My guess is that you need to add a define flag or change something in the configuration. Does this package come with any documentation? Are there alternated definitions for “GET_VAR_D0”, “PUT_VAR_D0”, and “GET_REC_D0N” that use “F90_TYPE”? If so, are they guarded with an “#ifdef”?

  • Mat

Thanks for the reply, Mat,

So I’ve followed the suggestion to change

45 #define GET_VAR_D0 GET_VAR(NF_TYPE, D0) to

45 #define GET_VAR_D0 GET_VAR(F90_TYPE, D0).

However the error message still showed up and this time it is like this,
PGF90-S-0034-Syntax error at or near identifier integer (/…getput.inc: 114)
while line 114 is
module procedure GET_VAR_D0, GET_VAR_D1, GET_VAR_D2, GET_VAR_D3

So it turns out that the compiler can’t recognize the F90_type either. This makes me wonder if it was missing something…

And, to answer your question. This package is not a published one, so it comes very little documentation. And “GET_VAR_D0”, “PUT_VAR_D0”, and “GET_REC_D0N”, all these stuff only appear in this code, I couldn’t find any other definitions…
One other thing I think is relevant is in the beginning of getput.inc, it checks whether the NF_type and F90_type have been defined, like this

9 #ifndef F90_TYPE
10 error F90_TYPE is not defined: must be one of FORTRAN 90 types
11 #endif
12
13 #ifndef NF_TYPE
14 error NF_TYPE is not defined: must be netcdf type name corresponding to F90_TYPE
15 #endif

While I didn’t see error messages, I’d assume they were all well-defined. Please correct me if I was wrong about this…

Thanks again for your help
Chiyu

Hi Chiyu,

So I’ve followed the suggestion to change

Sorry for the misunderstanding but I didn’t mean for you to change the instances of NF_TYPE to F90_TYPE. Instead, you need to look through the documentation and/or configuration on how to best configure this code for a Fortran target. Granted, my assumption is that this code has been successfully compiled at some point so some configuration should work.

Is the code publicly accessible on the web? Is so, please post a link and I’ll take a look.

  • Mat

Hi Mat,

I don’t think this package is publicly accessible through the internet… Sorry about this. I wish I can provide you a copy to look through, but for some legal copyright thing I don’t think I am able to do this…

All I can tell is the package has been successfullt compiled using intel fortran compiler. Because we don’t have that in our system so I gotta use pgi compiler. In this package there is a mkmf template for pgi so I was just using this. Not sure if this information useful or not, but can you ithink of any difference between intel and pgi compiler that might cause the problem…

Or please kindly ask for any additional information that might help to solve this issue, I will do my best to provide information.

Thanks a lot.

  • Chiyu

Can you try using the same configuration options as the Intel compiler?

If that still doesn’t work, my next step would be to have the compiler stop after the preprocessing step (i.e add the “-F” flag). Then compile the resulting “.f” file and examine the errors. Determine what’s the error and then trace the Macros backwards to understand why the bad format is being used.

Unfortunately I don’t have enough information to know what’s wrong. The more examples you can provide, the better I can help.

  • Mat

Hi Mat,

thanks for all the helps you kindly provided. the S-0034 errors have been proved that they were due to the discrepancy between the intel and pgi compilers, and they have been taken care of.

however, some new error messages showed up now regarding S-0067 error. Here it is:
PGF90-S-0067-Too many data constants in initialization statement (/…get_atmos_data.F90: 61).
The code is trying to initialize 8 constants here at Line 61.

Also, I’ve found another thread in this forum that mentioned this might be the bug in PGI 6.1 compilers, which is what I’m using right now. Please see the following link,
https://forums.developer.nvidia.com/t/compiler-error-data-intialization/130442/1

If this is the case, how can I solve it?

Thanks,
Chiyu

Hi chiyu71,

If this is the case, how can I solve it?

Assuming that it’s the same issue, this error (TPR#3878) was fixed in the 6.2-1 so you will need to update your compiler.

Best Regards,
Mat