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: Adrianos Lahanas <address@hidden> >Subject: Bug dedected >Organization: . >Keywords: 199707251438.IAA29699 Hi Adrianos, > I am running netCDF 3.3.1 software and for the moment seems to > work. When I tried to read a large array ("rhum") the program > stop unsuccessfuly executing . > > Below is the program I used to test and the execution > stack of the program reported by the debugger. > > #include <stdio.h> > #include <stdlib.h> > > #include "netcdf.h" > > #define TIMES 2 > #define LON 144 > #define LAT 73 > #define LEVEL 7 > > > void handle_error(int status); > > main(argc, argv) > int argc; > char *argv[]; > { > int status; > int rh_id, ncid; > short rhum_val[LEVEL*TIMES*LON*LAT]; > int counter; > > if ( argc != 2 ) { > printf("Usage: executable <filename>\n"); > return; > } > status = nc_open(argv[1],NC_NOWRITE,&ncid); > if (status != NC_NOERR) handle_error(status); > > status = nc_inq_varid (ncid,"rhum",&rh_id); > if (status != NC_NOERR) handle_error(status); > > status = nc_get_var_short(ncid, rh_id, rhum_val); > if (status != NC_NOERR) handle_error(status); > > for (counter = 0;counter < LEVEL;counter++) { > printf(" %d ",rhum_val[counter]); > if ((counter % 10) == 0) printf("\n"); > } > > status = nc_close(ncid); > if (status != NC_NOERR) handle_error(status); > } > > void handle_error(int status) > { > if (status != NC_NOERR) { > fprintf(stderr, "%s\n", nc_strerror(status)); > exit( -1 ); > } > } > > > > And here is the dbx stack report: > > moveeq._moveeq() at 0x1000316c > ncx_getn_short_short() at 0x1000c330 > getNCvx_short_short() at 0x10012574 > nc_get_var_short() at 0x10018b6c > main(0xa4d3a4d3, 0xa4d3a4d3) at 0x1000029c > > > P.S > > We run the program on AIX 4.2 w/station. I'll need more information before I can call this a bug. It worked fine when I just compiled and ran it on our AIX 4.2 platform. I generated a sample data file from the following CDL file (that I named abug.cdl): netcdf abug { dimensions: times = 2; lon = 144; lat = 73; level = 7; variables: short rhum(times, lon, lat, level); data: rhum = 0,1,2,3,4,5,6; } using ncgen -b abug.cdl which generated the netCDF file "abug.nc". Running your program with the argument "abug.nc" produced the output: 0 1 2 3 4 5 6 as expected. So I can't reproduce the bug. And if you did "make test" and it succeeded, it already tested many calls to nc_get_var_short(). Can you try it using the test file as generated above with ncgen to see if it gets an error? And if not, can you supply a small example that fails? Thanks. --Russ _____________________________________________________________________ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu