Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ncgen 4.4.0 fails to parse in.cdl #156

Closed
DennisHeimbigner opened this issue Nov 16, 2015 · 3 comments
Closed

ncgen 4.4.0 fails to parse in.cdl #156

DennisHeimbigner opened this issue Nov 16, 2015 · 3 comments

Comments

@DennisHeimbigner
Copy link
Collaborator

Moving discussion of e-support PNU-748333 / Jira NCF-345 to Github issue.

@DennisHeimbigner
Copy link
Collaborator Author

Charlie Zender note:
ncgen 4.3.3.1 works but 4.4.0 (today) fails to parse in.cdl.
i think this has been broken for many weeks in 4.4.0.
it seems possible that ncgen barfs when it encounters
values affixed with "l" for long when generating netcdf3 files.
however, i thought that bug had been fixed long ago and it
was decided that "l" means int when referring to netCDF3 files
for backwards compatibility to days when NC_LONG was the norm.
or maybe it's a different issue entirely.
file is attached.
chokes on line 705...

zender@givre:/nco/data$ ncgen -b -o in.nc in.cdl
ncgen: cdl line 705; NetCDF: Not a valid data type or _FillValue type
mismatch
(genbin.c:508)
zender@givre:
/nco/data$ ncgen --version
ncgen: invalid option -- '-'
Usage: ncgen [-1] [-3] [-4] [-5] [-6] [-7] [-b] [-B buffersize] [-d] [-D
debuglevel] [-h] [-k kind ] [-l language=b|c|f77|java] [-M ] [-n]
[-o outfile] [-P] [-x] [file ... ]
netcdf library version 4.4.0-development of Nov 12 2015 14:22:53 $

Charlie Zender, Earth System Sci. & Computer Sci.
University of California, Irvine 949-891-2429 )'(

@DennisHeimbigner
Copy link
Collaborator Author

Without even looking at the code, I will claim responsibility
for this. The problem is that the long type is ambiguous in C.
On some machines, it is 32 bits, and on others it is 64 bits.
That is why the ll suffix is preferred because it is always 64 bits.
This is also one of the reasons that NC_LONG in netcdf.h is aliased
to NC_INT.

I will go ahead and add the 'l' suffix to ncgen.l as an alias to integer.
=Dennis Heimbigner
Unidata

@WardF WardF added this to the 4.4.0 milestone Nov 16, 2015
DennisHeimbigner pushed a commit that referenced this issue Nov 18, 2015
Modified ncgen to properly handle the L and UL suffixes for integer constants
to keep backward compatibility. Now it is the case the single L suffix
(e.g. 111L) is treated as a 32 bit integer. This makes it consistent with
the fact that NC_LONG (netcdf.h) is an alias for NC_INT.
It is probable that .cdl files now exist that assumed that L prefix was
64 bits. This will cause problems.

Changes:
- ncgen.l - fix lexing involving L/LL suffix.
- misc. test cases: either .cdl files, or ncdump reference files or .c files.
- semantics.c: to fix type inference rules for untyped attributes
- ncdump: the code was dumping constant text using the L prefix.
@WardF
Copy link
Member

WardF commented Nov 27, 2015

Closing this out as it appears to be corrected!

@WardF WardF closed this as completed Nov 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants