This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
Dear Magnus Weis, >Date: Fri, 10 May 1996 08:31:44 +0200 >From: Magnus Weis <address@hidden> >Organization: . >To: address@hidden >Subject: segmentation fault problems with netCDF >Keywords: 199605101037.AA26051 In the above message you wrote: > > 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 !!! > > > > That's what gdb on my LINUX system gave me, really. The above line should be enabled on a Linux system, since the *86 family of CPU's are little endian. > With AIX I got > > Program received signal SIGSEGV, Segmentation fault. > 0x1000edc8 in _moveeq () > > Has this system routine also something to do with xdr ? > I don't know. I would assume, however, that the above indicated line isn't responsible since SWAP should be 0 or undefined on an RS6000. > > >Would you please do to the following: > > > > 1. Go to your top-level, netCDF source directory. > > > > 2. Send me the output from the following commands: > > > > uname -a > > grep netlong config.status > > grep NETLONG config.status > > grep SWAP config.status > > OK, here it is: > > Linux wegener 1.3.97 #5 Thu May 2 09:05:19 MET DST 1996 i586 > ${ac_dA}INLINE${ac_dB}INLINE${ac_dC}netlong${ac_dD} > ${ac_uA}INLINE${ac_uB}INLINE${ac_uC}netlong${ac_uD} > ${ac_eA}INLINE${ac_eB}INLINE${ac_eC}netlong${ac_eD} > ${ac_dA}NETLONG${ac_dB}NETLONG${ac_dC}long${ac_dD} > ${ac_uA}NETLONG${ac_uB}NETLONG${ac_uC}long${ac_uD} > ${ac_eA}NETLONG${ac_eB}NETLONG${ac_eC}long${ac_eD} > ${ac_dA}SIZEOF_NETLONG${ac_dB}SIZEOF_NETLONG${ac_dC}4${ac_dD} > ${ac_uA}SIZEOF_NETLONG${ac_uB}SIZEOF_NETLONG${ac_uC}4${ac_uD} > ${ac_eA}SIZEOF_NETLONG${ac_eB}SIZEOF_NETLONG${ac_eC}4${ac_eD} > ${ac_dA}INTERNAL_NETLONG${ac_dB}INTERNAL_NETLONG${ac_dC}long${ac_dD} > ${ac_uA}INTERNAL_NETLONG${ac_uB}INTERNAL_NETLONG${ac_uC}long${ac_uD} > ${ac_eA}INTERNAL_NETLONG${ac_eB}INTERNAL_NETLONG${ac_eC}long${ac_eD} > ${ac_dA}SIZEOF_INTERNAL_NETLONG${ac_dB}SIZEOF_INTERNAL_NETLONG${ac_dC}4${ac_dD} > ${ac_uA}SIZEOF_INTERNAL_NETLONG${ac_uB}SIZEOF_INTERNAL_NETLONG${ac_uC}4${ac_uD} > ${ac_eA}SIZEOF_INTERNAL_NETLONG${ac_eB}SIZEOF_INTERNAL_NETLONG${ac_eC}4${ac_eD} > ${ac_dA}SWAP${ac_dB}SWAP${ac_dC}1${ac_dD} > ${ac_uA}SWAP${ac_uB}SWAP${ac_uC}1${ac_uD} > ${ac_eA}SWAP${ac_eB}SWAP${ac_eC}1${ac_eD} > Ok. It looks like the configuration script worked for your system. A `netlong' is a `long' and is 4 bytes. Internally, the XDR implementation uses a 4-byte `long' to contain the 4 bytes of a `netlong'. This is all correct. I suspect that the `lp' pointer that is being handed to the xdrposix_putlong() function is pointing to unallocated memory. Because I have no way to check on that here, you'll have to do it. I suggest that you recompile the netCDF library on the Linux system to support symbolic debugging, run your program, and then backtrack from the segmentation fault to see where the `lp' variable points. Please let me know if this helps. -------- Steve Emmerson <address@hidden>