[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unidata Support: 980227: nc_test fails for alpha/linux



Chris,

> From: Chris Moen <address@hidden>
> Subject: nc_test fails for alpha/linux
> Organization: Sandia National Laboratories
> Keywords: 199802270136.SAA14365 netCDF 3.3 DEC Alpha Linux

In the above message, you wrote:

> I am trying to build netcdf (version 3.3, 3.3.1,
> and/or 3.4a) on an Alpha-box running linux (kernel 2.0.30) 
> using gcc (2.7.2.1).  The code builds and passes tests 
> in libsrc and nctest, but fails in nc_test.
> 
> make[2]: Entering directory `/home/cmoen/netcdf-3.4a/src/nc_test'
> cc -c -O -I../libsrc  test_get.c
> cc -c -O -I../libsrc  test_put.c
> cc -c -O -I../libsrc  test_read.c
> cc -c -O -I../libsrc  test_write.c
> cc -c -O -I../libsrc  util.c
> cc -o nc_test -O  nc_test.o error.o test_get.o test_put.o test_read.o
> test_write.o util.o -L../libsrc -lnetcdf -lm 
> ./nc_test -c
> make[2]: *** [test.nc] Floating point exception (core dumped)
> make[2]: *** Deleting file `test.nc'
> make[2]: Leaving directory `/home/cmoen/netcdf-3.4a/src/nc_test'
> make[1]: *** [subdir_target] Error 1
> make[1]: Leaving directory `/home/cmoen/netcdf-3.4a/src'
> make: *** [nc_test/test] Error 2
> 
> 
> 
> 
> ...with debugging, I die in:
> 
> Program received signal SIGFPE, Arithmetic exception.
> 0x120097c0c in ncx_put_float_double () at ncx.c:1263
> 1263    float xx = (float) *ip;
> (gdb) p ip
> $2 = (double *) 0x11ffff9c0
> (gdb) p *ip
> $3 = -3.402823872033458e+38
> (gdb) n
> 
> Program terminated with signal SIGFPE, Arithmetic exception.
> 
> The values passed to nc_put_att_double for j=4 are
> 
> 84     err = nc_put_att_double(ncid, i, ATT_NAME(i,j),
> 585         ATT_TYPE(i,j), ATT_LEN(i,j), att);
> 
> nc_put_att_double(6,-1,Gf,NC_FLOAT,5,-3.4028234663852886e+38)
> 
> 
> ...any idea why this fails?
> 
> Thanks,
> Chris Moen
> 
> - - -- 
> 
> /------------------------------------------------\
> | Christopher D. Moen                            |
> | Computational Reactive                         |
> |    Processes Department     ph: (510) 294 3709 |
> | Sandia National Laboratory  fx: (510) 294 1459 |
> | P.O. Box 969               address@hidden |
> | Livermore, CA  94551-0969                      |
> \------------------------------------------------/

We've seen this problem before.  It doesn't indicate a problem with the
netCDF package per se, but rather with the testing of the netCDF package
(and the not-quite standard behavior of Linux).  The solution is to
install the following SIGFPE signal handler (which does nothing) in the
file fortran/nc_test.c:

    handle_fpe()
    {
        /* Just ignore SIGFPE */
    }

and then to register the signal handler with the following code at 
the appropriate point:

    (void) signal(SIGFPE, (void *)handle_fpe);

You can find details on this (including a patch) by going to the netCDF
home page at

    http://www.unidata.ucar.edu/packages/netcdf/

Click on the "netCDF support e-mail archive" link and enter the search
string "199709162327.RAA11816".  Then, click on the first link
presented (i.e. the most recent one).

Please let me know if this helps.

--------
Steve Emmerson   <http://www.unidata.ucar.edu>