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)

  • 1996 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: