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

Re: 20051208: netcdf-3.6.0-p1, 32-bit compile on x86_64 system -- Assertion failure in odo1



Greg,

Almost a month ago, you wrote:

> I are running netcdf-3.6.0-p1 on an x86-64 system compiled in 32-bit
> mode with gcc-3.4.4.
>
> I get an assertion failure in odo1 with the assertion "assert(coord <=
> cdp && cdp <= coord + NC_MAX_DIMS)"  (line 4316 of putget.c)
>
> The value of coord is "0xffffb9f0" which is also the value of cdp. 
> However, when NC_MAX_DIMS (65536 in our code) is added to coord, the
> resulting value overflows a 32-bit integer and results in the value of
> 0x3b9f0 which is less than cdp and the assertion fails.
>
> Does this look like a bad build, or is the assertion being too cautious?

and subsequently:

> Yes, we have had to increase NC_MAX_DIMS (65536) and NC_MAX_VARS
> (524288) for our use; NC_MAX_VAR_DIMS is reduced to 8.  Is there an
> assumption somewhere in the code that NC_MAX_DIMS is not increased that
> is causing our problem? Or, should the assert be checking
> coord+NC_MAX_VAR_DIMS instead?

The latter, the assertions at line 1067 in putget.m4 should actually
be:

        assert(coord <= cdp && cdp <= coord + NC_MAX_VAR_DIMS);
        assert(upper <= upp && upp <= upper + NC_MAX_VAR_DIMS);

which no one ever noticed before, since in netcdf.h we have:

  #define NC_MAX_VAR_DIMS       NC_MAX_DIMS /* max per variable dimensions */

This bug will be fixed in the next release.

Sorry again that it took so long to reply!

--Russ