[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

961213: bug in Fortran with netcdf 3.2a



Kate,

[Glenn, ignore the first problem and look at the second -- Steve]

> To: address@hidden
> From: Kate Hedstrom <address@hidden>
> Subject: bug in Fortran with netcdf 3.2a
> Organization: Rutgers University
> Keywords: 199612131519.AA21343

In the above message you wrote:

> I was having trouble with version 2.4.2 on the Cray (and using 2.3.2
> instead) so decided to see if version 3.x was going to help me.
> I got a core dump when calling ncvdef to create a scalar.  I tracked
> it down to a  problem in reverse in jackets.c when length is 0.
> reverse then assigns "j = length - 1" and since j is a size_t, I get
> "j = 4294967295U" instead of "j = -1".

While I don't doubt that this is what you discovered, I don't understand
how it can be.  The variables `i' and `j' in the function `reverse()' in
the file `fortran/jackets.src' (from which file `fortran/jackets.c' is
created') have always been of type `int'.  This goes all the way back to
netCDF version 1.09 and includes versions 2.4.2 and 2.3.2.  Also, if the
FORTRAN API was busted this way, then no FORTRAN programmer would have
been able to create scalars for all the years that the netCDF packge has
been out there (which seems unlikely).

Would you please look at file `fortran/jackets.src'.  What is the type
of variable `j' in function `reverse()'?

> By the way, I didn't quite follow the directions on email for including
> the Fortran into version 3.x.  I copied the fortran and port
> directories over from version 2.4.3 and changed netcdf.inc to be more
> compatible with the new netcdf.h.  It is below.

Thanks.  Since I'm not up on incorporating netCDF 2.4 FORTRAN stuff into
netCDF 3, however, I'll pass this on to Glenn Davis (who is).

> 
> Kate
> - - --
> Kate Hedstrom               Institute of Marine and Coastal Sciences
> address@hidden       Rutgers University
> 
> !      
> !     Functions in the FORTRAN interface
> 
>       integer nccre, ncopn, ncddef, ncdid, ncvdef, ncvid, nctlen
>       integer ncsfil
>       external nccre, ncopn, ncddef, ncdid, ncvdef, ncvid, nctlen
>       external ncsfil
> 
> !     integer NCRDWR,NCCREAT,NCEXCL,NCINDEF,NCNSYNC,NCHSYNC
> !     integer NCNDIRTY,NCHDIRTY,NCLINK,NCNOWRIT,NCWRITE
> !     integer NCCLOB,NCNOCLOB,NCGLOBAL,NCFILL,NCNOFILL
>       integer NCNOWRIT,NCWRITE
>       integer NCCLOB,NCNOCLOB,NCFILL,NCNOFILL
>       integer MAXNCOP,MAXNCDIM,MAXNCATT,MAXNCVAR
>       integer MAXNCNAM,MAXVDIMS,NCNOERR,NCEBADID
>       integer NCENFILE,NCEEXIST,NCEINVAL,NCEPERM,NCENOTIN
>       integer NCEINDEF,NCECOORD,NCEMAXDS,NCENAME
>       integer NCENOATT,NCEMAXAT,NCEBADTY,NCEBADD, NCESTS
>       integer NCEUNLIM,NCEMAXVS,NCENOTVR,NCEGLOB,NCENOTNC
> !     integer NCFOOBAR,NCSYSERR,NCFATAL,NCVERBOS, NCENTOOL
>       integer NCSYSERR,NCFATAL,NCVERBOS
>       
>       integer NCBYTE,NCCHAR,NCSHORT,NCLONG,NCFLOAT,NCDOUBLE,NCINT
>       
>       parameter(NCBYTE = 1)
>       parameter(NCCHAR = 2)
>       parameter(NCSHORT = 3)
>       parameter(NCLONG = 4)
>       parameter(NCINT = 4)
>       parameter(NCFLOAT = 5)
>       parameter(NCDOUBLE = 6)
>       
> !     
> !     masks for the struct NC flag field; passed in as 'mode' arg to
> !     nccreate and ncopen.
> !     
>       
> !     read/write, 0 => readonly 
> !     parameter(NCRDWR = 1)
> !     in create phase, cleared by ncendef 
> !     parameter(NCCREAT = 2)
> !     on create destroy existing file 
> !     parameter(NCEXCL = 4)
> !     in define mode, cleared by ncendef 
> !     parameter(NCINDEF = 8)
> !     synchronise numrecs on change (X'10')
> !     parameter(NCNSYNC = 16)
> !     synchronise whole header on change (X'20')
> !     parameter(NCHSYNC = 32)
> !     numrecs has changed (X'40')
> !     parameter(NCNDIRTY = 64)        
> !     header info has changed (X'80')
> !     parameter(NCHDIRTY = 128)
> !     prefill vars on endef and increase of record, the default behavior
>       parameter(NCFILL = 0)
> !     do not fill vars on endef and increase of record (X'100')
>       parameter(NCNOFILL = 256)
> !     isa link (X'8000')
> !     parameter(NCLINK = 32768)
>       
> !     
> !     'mode' arguments for nccreate and ncopen
> !     
>       
>       parameter(NCNOWRIT = 0)
>       parameter(NCWRITE = 1)
>       parameter(NCCLOB = 0)
>       parameter(NCNOCLOB = 4)
> !     
> !     'size' argument to ncdimdef for an unlimited dimension
> !     
>       integer NCUNLIM
>       parameter(NCUNLIM = 0)
>       
> !     
> !     attribute id to put/get a global attribute
> !     
>       parameter(NCGLOBAL  = 0)
> !     
> !     Advisory Maximums
> !     
>       parameter(MAXNCOP = 32)
>       parameter(MAXNCDIM = 100)
>       parameter(MAXNCATT = 2000)
>       parameter(MAXNCVAR = 2000)
> !     Not enforced 
>       parameter(MAXNCNAM = 128)
>       parameter(MAXVDIMS = MAXNCDIM)
>       
>       
> !     
> !     The netcdf data types
> !     
>       
> !     
> !     Global netcdf error status variable
> !     Initialized in error.c
> !     
>       
> !     No Error 
>       parameter(NCNOERR = 0)
> !     Not a netcdf id 
>       parameter(NCEBADID = -33)
> !     Too many netcdfs open 
>       parameter(NCENFILE = -34)       
> !     netcdf file exists && NCNOCLOB
>       parameter(NCEEXIST = -35)
> !     Invalid Argument 
>       parameter(NCEINVAL = -36)
> !     Write to read only 
>       parameter(NCEPERM = -37)
> !     Operation not allowed in data mode 
>       parameter(NCENOTIN = -38)       
> !     Operation not allowed in define mode 
>       parameter(NCEINDEF = -39)       
> !     Coordinates out of Domain 
>       parameter(NCECOORD = -40)
> !     MAXNCDIMS exceeded 
>       parameter(NCEMAXDS = -41)
> !     String match to name in use 
>       parameter(NCENAME = -42)        
> !     Attribute not found 
>       parameter(NCENOATT = -43)
> !     MAXNCATTRS exceeded 
>       parameter(NCEMAXAT = -44)
> !     Not a netcdf data type 
>       parameter(NCEBADTY = -45)
> !     Invalid dimension id 
>       parameter(NCEBADD = -46)        
> !     NCUNLIMITED in the wrong index 
>       parameter(NCEUNLIM = -47)
> !     MAXNCVARS exceeded 
>       parameter(NCEMAXVS = -48)
> !     Variable not found 
>       parameter(NCENOTVR = -49)
> !     Action prohibited on NCGLOBAL varid 
>       parameter(NCEGLOB = -50)
> !     Not a netcdf file 
>       parameter(NCENOTNC = -51)
> !     Fortran string too short
>       parameter(NCESTS = -52)
> !     parameter (NCENTOOL = -53)      
> !     parameter(NCFOOBAR = -54)
>       parameter(NCSYSERR = -1)
>       
>       
> !     
> !     Global options variable. Used to determine behavior of error handler.
> !     Initialized in lerror.c
> !     
>       parameter(NCFATAL = 1)
>       parameter(NCVERBOS = 2)
> 
> !
> !     Default fill values.  These must be the same as in the C interface.
> !
>       double precision FILDOUB
>       integer FILLONG
>       REAL FILFLOAT
>       integer*2 FILSHORT
>       byte FILCHAR,FILBYTE
>       parameter (FILDOUB = 9.9692099683868690e+36)
>       parameter (FILLONG = -2147483647)
>       parameter (FILFLOAT = 9.9692099683868690e+36)
>       parameter (FILSHORT = -32767)
>       parameter (FILCHAR = 0)
>       parameter (FILBYTE = -127)
> 
> 
> - ------- End of Forwarded Message
> 
> 
> ------- End of Forwarded Message

--------
Steve Emmerson   <address@hidden>