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

Segmentation fault in process_4dot2.c #60

Open
DusanJovic-NOAA opened this issue Jun 2, 2022 · 2 comments
Open

Segmentation fault in process_4dot2.c #60

DusanJovic-NOAA opened this issue Jun 2, 2022 · 2 comments
Assignees
Labels
bug Something isn't working question Further information is requested

Comments

@DusanJovic-NOAA
Copy link

The following test program segfaults:

$ cat test4.2.f90 
  program test42
    implicit none
    integer ierr
    character(len=20) :: fl_nametbl='params_grib2_tbl_new'

    call open_and_read_4dot2( fl_nametbl, ierr )
    print *, ierr
    call close_4dot2(ierr)
    print *, ierr

    call open_and_read_4dot2( fl_nametbl, ierr )
    print *, ierr
    call close_4dot2(ierr)
    print *, ierr

  end program test42

$ gfortran test4.2.f90 /scratch2/NCEPDEV/nwprod/hpc-stack/libs/hpc-stack/gnu-9.2.0/g2tmpl/1.10.2/lib/libg2tmpl.a 

$ ./a.out 
           0
           0

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
#0  0x7f4cf49383ff in ???
#1  0x7f4cf4985d1d in ???
#2  0x7f4cf4987e11 in ???
#3  0x400fcf in open_and_read_4dot2_
        at /scratch2/NCEPDEV/nwprod/hpc-stack/src/develop/pkg/g2tmpl-v1.10.2/src/process_4dot2.c:158
#4  0x400d98 in ???
#5  0x400e9f in ???
#6  0x7f4cf4924554 in ???
#7  0x400be8 in ???
#8  0xffffffffffffffff in ???
Segmentation fault
@edwardhartnett edwardhartnett self-assigned this Jun 2, 2022
@edwardhartnett edwardhartnett added the bug Something isn't working label Jun 2, 2022
@edwardhartnett edwardhartnett added the question Further information is requested label Aug 26, 2022
@edwardhartnett
Copy link
Contributor

Can you tell me what this code does?

I know that it relates to the ASCII table we have, called params_grib2_tbl_new.text, which contains this kind of thing:

!
!Table History Log: 
!2010-01-21         V. Krishna Kumar/NCO/SIB
!2011-09-25         V. Krishna Kumar updated the parameters since
!                   the 2010 implemenation
!2012-01-25         J. WANG          updated table 4.2-0-20 
!2013-08-08         B. VUONG         Added more parameters 
!2015-08-26         B. VUONG         Added more parameters and
!                                    updated table 4.2-0-20
!2017-02-28         B. VUONG         Added more parameters and
!                                    new tables 4.2-3-2,3,4,and 6
!2019-07-02         B. VUONG         Added more parameters 
!2021-04-20         B. VUONG         Added more parameters 
!
!GRIB2 parameter table for all disciplines and categories
!The fields in order are grib2_discipline  grib2_category 
!grib2_parameter_number grib2_table_information (0 for the parameter
!from the WMO table and 1 for the parameter from the NCEP local table)
!grib2_NCEP_mnemonic (locally defined at NCEP). WMO parameters have values
!ranging from 0 to 191 and NCEP local table parameters have values from 192  
!to 254 and the parameter value 255 is a missing or undefined.
!Comment cards with the ! will not be read by the program 
!
!
! GRIB2 - TABLE 4.2-0-0 PARAMETERS FOR DISCIPLINE 0 CATEGORY 0
!
   0   0     0   0 TMP
   0   0     1   0 VTMP
   0   0     2   0 POT
   0   0     3   0 EPOT

What do we use this table for? Why do we process it?

Any answers would be most helpful, and will be added to the documentation for this poorly-documented code.

@edwardhartnett
Copy link
Contributor

Some of my questions above are answered here: #40

Others are answered in recent additions to the doxygen docs for this project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
Development

No branches or pull requests

2 participants