This problem is reproducible in netcdf-c 4.7.3 on both Mac OS and Linux.
In particular it occurs in the standard netcdf "make check", but is not
properly reported, due to a bug in the test suite. Please see github issue
#1576 <https://github.com/Unidata/netcdf-c/issues/1576>.
Notice that in 4.7.3, ncgen behavior changed from an assertion failure, to
a more controlled single message. This new message points specifically to
a problem with defining enum data values inside a compound type.
lt-ncgen: tmp1.cdl line 53: Enumconstant associated with a non-econst
type
I am unsure whether the CDL is correct. This could be either a real ncgen
bug, or incorrect CDL from two different sources.
On Sat, Dec 14, 2019 at 10:52 AM Remik Ziemlinski <remik@xxxxxxxxxxxx>
wrote:
> I get a crash with these steps on macos with Homebrew netcdf:
>
> $ which ncgen
> /usr/local/bin/ncgen
>
> $ ncgen -h
> netcdf library version 4.6.3 of Oct 1 2019 15:44:39 $
>
> $ cat > bug.cdl << EOF
> netcdf bug {
> types:
> int enum enum1 {A = -1, B = 0, C = 1} ;
> compound comp1 {
> enum1 e1;
> };
>
> dimensions:
> dim1 = 2 ;
> variables:
> enum1 var1(dim1) ;
> comp1 var2(dim1) ;
> data:
> var1 = A, A ;
> var2 = {A}, {A} ;
> }
> EOF
>
> $ ncgen -k nc4 -o bug.nc bug.cdl
> assertion failure: econst->subclass == NC_ECONST
>
> Abort trap: 6
>
> Another user reported this on centos with netcdf4.7
> (https://gitlab.com/remikz/nccmp/issues/10)
>
> I do not get this problem when using netcdf 4.6.3 built from scratch on
> Ubuntu 16.04.3 LTS with GCC 5.4.0-6ubuntu1~16.04.12.
>
> Remik
>