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: Edward Colon <address@hidden> >Subject: segmentation fault from gennet.f >Organization: Comparative Planetology Laboratory, University of Louisville >Keywords: 200007171948.e6HJmcT11051, gennet.f, user-contributed software Hi Edward, > I am utilizing the gennet.f fortran code to read a netcdf diagnostic > file produced by a planetary isentropic vertical coordinate model. The > gennet code does successfully produce a code that begins to read the > netcdf file but will yield a segmentation fault when it attempts to > read beyond the 22nd of 28 variables generated by the model. I have > attempted to run the gdb debugger on the executable when I attempt to > process the 23rd variable read and receive the cryptic error > > Program received signal SIGSEGV, Segmentation fault. > 0x805ff5f in getNCvx_double_double () Such an error typically means you are trying to store a value beyond the memory allocated for the program. In Fortran, this often indicates an array bounds error. With a netCDF call, it would be easy to try to read more values than the array has space allocated for, which would cause such an error. > In the program code, the execution fails at > > CALL NCVGT(NCID,ivarid,START,COUNT, > +dhthetadt ,RCODE) > > I am guessing that there may be a problem with memory allocation so > that I am including the variable initialization statements You might want to print out the values of the START and COUNT arrays and make sure they don't exceed the associated dimension of the netCDF variable you are trying to read from, dhthetadt. For example, if the shape of dhthetadt were (128, 65, 8, 2), START was (1, 1, 1, 1, ...) and count was (128, 65, 8, 3, ...), this could generate a segmentation violation. Other than that, we can't help much with GENNET.F, since it is user-contributed software that we didn't write and thus don't support. You might contact the author (Barry Schwartz) for more assistance. The last email address I have for him is <address@hidden>. --Russ _____________________________________________________________________ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu