Unidata - To provide the data services, tools, and cyberinfrastructure leadership that advance Earth system science, enhance educational opportunities, and broaden participation. Unidata
         
  advanced  
 

segmentation fault in drposix_putlong

Hi all,

I am trying to use netCDF for my work on numerical modelling of the
Greenland ice sheet.

So far, netCDF works very well. But it gives me segmentation faults
when I trie to write more than three or four data sets into one single
file (arrays have one unlimited dimension). It tried it under LINUX
and also on an IBM RS6000 with AIX3.2. In both cases I get the same
error, but at different times for both systems (but reproducable).

While debugging netCDF I found the location where the error occurs in
xdrposix.c:

static bool_t
xdrposix_putlong(xdrs, lp)
        XDR *xdrs;
        internal_netlong *lp;
{
#if SWAP
#   if SIZEOF_NETLONG != 4
#       include Unhandled condition: line=__LINE__, file=__FILE__
#   else
==>     netlong nl = htonl((netlong)*lp); <=== !!! HERE IT IS !!!

        if(biowrite((biobuf *)xdrs->x_private, (unsigned char*)&nl, 4) < 4)
                return (FALSE);
#   endif
#else   /* big endian below */
#   if SIZEOF_INTERNAL_NETLONG == 4
        if(biowrite((biobuf *)xdrs->x_private, (unsigned char*)lp, 4) < 4)
                return (FALSE);
#   elif SIZEOF_NETLONG == 4
        netlong nl = *lp;

        if(biowrite((biobuf *)xdrs->x_private, (unsigned char*)&nl, 4) < 4)
                return (FALSE);
#   else
        unsigned char *ucp = (unsigned char*)lp + SIZEOF_INTERNAL_NETLONG - 4;

        if(biowrite((biobuf *)xdrs->x_private, ucp, 4) < 4)
                return (FALSE);
#   endif
#endif  /* big endian above */
        return (TRUE);
}


And here it is, what I am doing:

        integer ncid, errno, ncd, ncv
        integer nc4dv(4)
        real*8 temp_r(0:KRMAX,0:JMAX,0:IMAX)

 
 
  Contact Us     Site Map     Search     Terms and Conditions     Privacy Policy     Participation Policy
 
National Science Foundation (NSF) UCAR Community Programs   Unidata is a member of the UCAR Community Programs, is managed by the University Corporation for Atmospheric Research, and is sponsored by the National Science Foundation.
P.O. Box 3000     Boulder, CO 80307-3000 USA     Tel: 303-497-8643     Fax: 303-497-8690