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.
>To: address@hidden >From: "Jae S. Choi" <address@hidden> >Subject: error -- posixio.c:277: failed assertion `offset < X_INT_MAX' .. >Abort trap >Organization: ? >Keywords: 200205291744.g4THicp21665 netCDF large file MacOS-X Hi Jae, > I am trying to use your library in my application and am obtaining the > following error: > > posixio.c:277: failed assertion `offset < X_INT_MAX' > Abort trap > > The datafile that is output is very large (2.4 GB). In comparison, the > ASCII formatted data dump is < 5MB. I have used the interface previously > with success on other platforms but am not sure what is causing the > current difficulty. Any help would be greatly appreciated. > > > Thank you in advance, > Jae > --- > > Background information: > > 1. complier: Absoft Fortran95 compiler (v7) with current updates. > 2. OS: MAC OS X/PPC > 3. all built-in tests complete successfully It turns out that the C library must be compiled with the -DNDEBUG flag in order to permit writing large files, because of an incorrect assert() statement left in for debugging purposes at line 277 of libsrc/posixio.c: assert(offset < X_INT_MAX); /* sanity check */ Compiling with -DNDEBUG turns off assertion checking and allows large files to be written. Alternatively you can just change the above statement to assert(offset >= 0); /* sanity check */ and recompile the library. We have also fixed occurrences of these too-strict assertions in the beta version netcdf-3.5.1-beta3.tar.Z available from ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-beta.tar.Z As to why your program is writing a large file (> 2 Gbytes) when you only have a few megabytes of data, I can't tell without a way to reproduce the problem. When you use "ncgen -b" on the ASCII (CDL) version of the file to generate the binary netCDF file, does ncgen also create the large file? Can you isolate the problem into a small program that demonstrates the bug? -- Russ _____________________________________________________________________ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu