I am trying to compile these programs with pgroup compilers:
http://www.nco.ncep.noaa.gov/pmb/codes/GRIB2/
First of all, the pgf90 4.0-2 I have licensed does not understand all constructs used in g2lib code, so I tried 5.2 compilers with the evaluation license. This compiles but segfaults when I try to run it.
pgdbg> run -g21 012.grib2 012.grib1
reloading ./cnvgrib
argv[0]= ./cnvgrib
argv[1]= -g21
argv[2]= 012.grib
argv[3]= 012.grib1
./cnvgrib loaded by ld-linux.so.2.
libz.so.1 loaded by ld-linux.so.2.
libc.so.6 loaded by ld-linux.so.2.
libpgc.so loaded by ld-linux.so.2.
libm.so.6 loaded by ld-linux.so.2.
ld-linux.so.2 loaded by ld-linux.so.2.
Signalled SIGSEGV at 0x80c3ba7, function __hpf_bcopysl
80c3ba7: 8b 14 98 movl (%eax,%ebx,4),%edx
pgdbg> stacktrace
STACK TRACE:
#6 __libc_start_main address: 0x40072177
#5 main address: 0x804a969
#4 cnvgrib line: “cnvgrib.f”@143 address: 0x804dcc4
#3 cnv21 line: “cnv21.f”@87 address: 0x805193c
ifl1 = 10 , ifl2 = 50
#2 pgf90_copy_f77_argl address: 0x80b516a
#1 local_copy file: rdst.c address: 0x80b348f
=> #0 __hpf_bcopysl address: 0x80c3c17
pgdbg> up
Call level:1 local_copy file: rdst.c address: 0x80b348f
pgdbg> up
Call level:2 pgf90_copy_f77_argl address: 0x80b516a
ERROR: No current source file.
pgdbg> up
Call level:3 cnv21 line: “cnv21.f”@87 address: 0x805193c
#87: call gdt2gds(igds,gfld%igdtmpl,gfld%num_opt,gfld%list_opt,
pgdbg> list
#82: igds(1)=gfld%griddef
#83: igds(2)=gfld%ngrdpts
#84: igds(3)=gfld%numoct_opt
#85: igds(4)=gfld%interp_opt
#86: igds(5)=gfld%igdtnum
#87:==>> call gdt2gds(igds,gfld%igdtmpl,gfld%num_opt,gfld%list_opt,
#88: & kgds,igrid,iret)
#89: if (iret.ne.0) then
#90: print *,‘cnv21: could not create gds’
#91: cycle
This looks like some bug in passing arguments to a subroutine.
I cannot be sure that there are no bugs in NCEP code there, but it seems to work for other people with other compilers. As I am currently using pgroup compilers, I thought to first try these.