Unidata - To provide the data services, tools, and cyberinfrastructure leadership that advance Earth system science, enhance educational opportunities, and broaden participation. Unidata
         
  advanced  
 

Re: Problems compiling netCDF3 (SIGFPE)

        "Problems compiling netCDF3" (Nov 28,  9:01pm)
References: <m0vTCce-0001T4C@xxxxxxxxxxxxxxx>

On Nov 28,  9:01pm, Tim Weilkiens wrote:

> ./nc_test -c
> make[2]: *** [test.nc] Floating point exception
> make[2]: *** Deleting file `test.nc'

We have run into a similar problem on other systems with the tests.
The test deliberatly tries to encode values which are "Out of Range" for
a given external type, in order to verify that the appropiate error code is
set.

What happens in the code (ncx.m4) is something like this:

        signed char *cp;
        double dd = some_big_number;

        ...

        if( dd > X_SCHAR_MAX || dd < X_SCHAR_MIN)
                return_code = NC_ERANGE;
        *cp = dd;

The idea is that we tell you that a range error (overflow) occured, but
let the system do what it would normally do. What the system actually does is
this situation is "undefined".  It turns out that on some systems, this
includes generating SIGFPE (Floating point exception).

In order to retain the behavior specified and yet have the test proceed,
we will have to ignore SIGFPE.
To nc_test/nc_test.c, #include <signal.h> and add a line like

        (void) signal(SIGFPE, SIG_IGN);

early in nc_test/nc_test.c main().

-glenn


 
 
  Contact Us     Site Map     Search     Terms and Conditions     Privacy Policy     Participation Policy
 
National Science Foundation (NSF) UCAR Community Programs   Unidata is a member of the UCAR Community Programs, is managed by the University Corporation for Atmospheric Research, and is sponsored by the National Science Foundation.
P.O. Box 3000     Boulder, CO 80307-3000 USA     Tel: 303-497-8643     Fax: 303-497-8690