Fortran program won't link with pgf90 -g

Hello,

I am trying to run a Fortran 90 program used with the WRF weather model. I am using
pgf90 6.0-2 on a 4-processor Opteron machine running 64-bit Fedora Core 3. The
program (“3DVAR_OBSPROC”, available from www.wrf-model.org) usually core dumps
(unless -Mchkfpstk or -Mchkstk is used without optimization). The really frustrating thing is that I cannot build an executable with the -g flag. I receive the following errors when linking:

pgf90 -o 3dvar_obs.exe
module_date.o module_namelist.o module_mm5.o module_map.o module_map_utils.o module_intp.o module_type.o module_func.o module_inside.o module_obs_merge.o module_per_type.o module_duplicate.o module_sort.o module_write.o module_complete.o module_recoverp.o module_diagnostics.o module_recoverh.o module_icao.o module_qc.o module_err_afwa.o module_err_ncep.o module_thin_ob.o
module_decoded.o
error_handler.o fm_decoder.o sort_platform.o qc_reduction.o check_obs.o setup.o
3dvar_obs.o
module_namelist.o(.debug_info+0x578): In function ..Dm_module_namelist': : undefined reference to …D12’
module_namelist.o(.debug_info+0x5d2): In function ..Dm_module_namelist': : undefined reference to …D26’
module_namelist.o(.debug_info+0x5d7): In function ..Dm_module_namelist': : undefined reference to …D27’
module_namelist.o(.debug_info+0x5dc): In function ..Dm_module_namelist': : undefined reference to …D28’
module_namelist.o(.debug_info+0x5e1): In function ..Dm_module_namelist': : undefined reference to …D29’
module_namelist.o(.debug_info+0x5f0): In function ..Dm_module_namelist': : undefined reference to …D30’
module_namelist.o(.debug_info+0x5f5): In function ..Dm_module_namelist': : undefined reference to …D31’
module_namelist.o(.debug_info+0x5fa): In function ..Dm_module_namelist': : undefined reference to …D32’
module_namelist.o(.debug_info+0x5ff): In function ..Dm_module_namelist': : undefined reference to …D33’
module_namelist.o(.debug_info+0x604): In function ..Dm_module_namelist': : undefined reference to …D34’
module_namelist.o(.debug_info+0x61d): In function ..Dm_module_namelist': : undefined reference to …D37’
module_namelist.o(.debug_info+0x622): In function ..Dm_module_namelist': : undefined reference to …D38’
module_namelist.o(.debug_info+0x627): In function ..Dm_module_namelist': : undefined reference to …D39’
module_namelist.o(.debug_info+0x62c): In function ..Dm_module_namelist': : undefined reference to …D40’
module_namelist.o(.debug_info+0x631): In function ..Dm_module_namelist': : undefined reference to …D41’
module_namelist.o(.debug_info+0x636): In function ..Dm_module_namelist': : undefined reference to …D42’
module_namelist.o(.debug_info+0x63b): In function ..Dm_module_namelist': : undefined reference to …D43’
module_namelist.o(.debug_info+0x640): In function ..Dm_module_namelist': : undefined reference to …D44’
make[1]: [3dvar_obs.exe] Error 2 (ignored)

Current compile flags (I’ve tried many) are -g -v -Ktrap=inv -tp k8-64 -mcmodel=medium -Mfreeform -O0 -Mrecursive -Mstandard -Mbounds. I get the same linking error when
I try building this code on a 32-bit Pentium machine with a pgf90 5.2 compiler.

Any ideas?

Eric Kemp
Northrop Grumman IT TASC

Hi Eric,

I’ve downloaded the code and have determined that the “-g” problem is a compiler bug. I’ve submitted a problem report to our engineers and hopefully we can get it fixed for the 6.1 release.

I was not able to recreate the seg fault but it looks like 3DVAR_OBSPROC requires the “-byteswapio” flag. Try adding this flag to you list of compiler options to see if the problem disappears. If this doesn’t fix it, can you post the steps you use to run the application including how to obtain a sample data set?

Thanks,
Mat

Hi Mat,

The -byteswapio does not fix the problem on my Opteron system.

I am using the sample dataset available on http://www.mmm.ucar.edu/wrf/src/data/wrfvar-testdata.tar.gz (specifically, the ob.little_r file, which contains sample weather observations for January 1 2003). The program will read in a file called ‘namelist.3dvar_obs’ to learn about directory paths and user options. I just copied the file ‘namelist.3dvar_obs.wrfvar-tut’ that comes in the
3DVAR_OBSPROC tarball and changed the path to ob.little_r.

When using the default Makefile flags (-Mfreeform -pc 32 -byteswapio), the program
seg faults somewhere in subroutine merge_sort (in module module_sort). But if I add the -Mchkstk flag the program runs and completes normally.

-Eric

Hi Eric,

First the good news. We were able to fix the “-g” problem for the 6.1 release. Also, the code compiles and runs fine with 6.1 (which should be available shortly) using the flags you listed as well as the default flag set.

Next, more good news. While I was able to reproduce the seg fault using the 6.0-5 compiler, if you compile at a higher optimization level (>= -O2) then the code runs fine. I’ve also been able run using “-tp k8-64 -fastsse -Mfreeform -byteswapio”.

Hope this helps,
Mat